Lync API - CaptureVideoWindow 和 RenderVideoWindow 为 Null [英] Lync API - CaptureVideoWindow and RenderVideoWindow are Null

查看:52
本文介绍了Lync API - CaptureVideoWindow 和 RenderVideoWindow 为 Null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了 Lync 2013 的 SDK,但在使用 AudioVideoConversation.csproj 中的代码示例时遇到了问题.该项目旨在演示通过 Lync API 使用音频/视频对话.我无法让视频部分在示例应用程序中运行.问题出在这种方法上:

I have downloaded the SDK for Lync 2013 and am having a problem with the code sample found in AudioVideoConversation.csproj. This project is supposed to demonstrate the use of Audio/Video conversations through the Lync API. I am having trouble getting the video portion to function in the sample application. The problem is in this method:

    /// <summary>
    /// Called when the video state changes.
    /// 
    /// Will show Incoming/Outgoing video based on the channel state.
    /// </summary>
    void videoChannel_StateChanged(object sender, ChannelStateChangedEventArgs e)
    {
        //posts the execution into the UI thread
        this.BeginInvoke(new MethodInvoker(delegate()
        {
            //updates the status bar with the video channel state
            toolStripStatusLabelVideoChannel.Text = e.NewState.ToString();


            //*****************************************************************************************
            //                              Video Content
            //
            // The video content is only available when the Lync client is running in UISuppressionMode.
            //
            // The video content is not directly accessible as a stream. It's rather available through
            // a video window that can de drawn in any panel or window.
            //
            // The outgoing video is accessible from videoChannel.CaptureVideoWindow
            // The window will be available when the video channel state is either Send or SendReceive.
            // 
            // The incoming video is accessible from videoChannel.RenderVideoWindow
            // The window will be available when the video channel state is either Receive or SendReceive.
            //
            //*****************************************************************************************

            //if the outgoing video is now active, show the video (which is only available in UI Suppression Mode)
            if ((e.NewState == ChannelState.Send 
                || e.NewState == ChannelState.SendReceive) && videoChannel.CaptureVideoWindow != null)
            {
                //presents the video in the panel
                ShowVideo(panelOutgoingVideo, videoChannel.CaptureVideoWindow);
            }

            //if the incoming video is now active, show the video (which is only available in UI Suppression Mode)
            if ((e.NewState == ChannelState.Receive 
                || e.NewState == ChannelState.SendReceive) && videoChannel.RenderVideoWindow != null)
            {
                //presents the video in the panel
                ShowVideo(panelIncomingVideo, videoChannel.RenderVideoWindow);
            }

        }));
    }

变量 videoChannel.CaptureVideoWindowvideoChannel.RenderVideoWindow 始终为 null(请注意,与 这个问题videoChannel 变量不为空).

The variables videoChannel.CaptureVideoWindow and videoChannel.RenderVideoWindow are always null (please note that, unlike this question, the videoChannel variable is NOT null).

你应该知道的一些事情:

Some things you should know:

  1. 我在 UI 抑制模式下运行 Lync(通过在位置 HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Lync 添加注册表项 UISuppressionMode [DWORD] 作为 1 来实现)
  2. 示例的音频部分效果很好
  3. 该示例实际上是发送我的视频流到远程方
  4. 当对话设置完成后,e.NewState == ChannelState.SendReceive 评估为 true
  5. 我在 Visual Studio 2012 和 Microsoft Lync 2013 中工作
  1. I am running Lync in UI Suppression mode (achieved by adding the registry key UISuppressionMode [DWORD] as 1 at location HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Lync)
  2. The audio portion of the sample works perfectly
  3. The sample is actually sending my video stream to the remote party successfully
  4. When the conversation is done setting up, e.NewState == ChannelState.SendReceive evaluates to true
  5. I am working in Visual Studio 2012 and Microsoft Lync 2013

推荐答案

我启动了一个我构建的旧演示(2014 年 1 月时间框架)并且一切正常.然后我安装了最新版本的 SDK 并运行了示例,果然,我遇到了同样的问题.

I fired up an old demo (January 2014 time frame) I built and everything worked fine. I then installed the latest version of the SDK and ran the sample and sure enough, I had the same issue.

问题是由于您尝试设置 Microsoft.Lync.Model.Conversation.AudioVideo.VideoWindow 的所有者时出现异常.

The issue is due to an exception when you try to set the owner of the Microsoft.Lync.Model.Conversation.AudioVideo.VideoWindow.

事实证明,接管此窗口的权限处理方式发生了变化.目前修复"是将应用程序放入运行该程序的帐户的用户文件夹中.我试过了,确实有效.

It turns out, there was a change in how permissions are handled for taking over this window. The "fix" for now is to place the application into the user folder of the account running the program. I tried this and it does, indeed work.

这是 ConversationWindow.cs:line 1128...

Here is the offending from ConversationWindow.cs:line 1128...

//sets the properties required for the native video window to draw itself
videoWindow.Owner = videoPanel.Handle.ToInt32();

这里是错误:

System.UnauthorizedAccessException"类型的第一次机会异常发生在 Microsoft.Lync.Model.dllSystem.UnauthorizedAccessException:访问被拒绝.(例外来自HRESULT: 0x80070005 (E_ACCESSDENIED)) 在Microsoft.Office.Uc.VideoWindowClass.set_Owner(Int32 Owner) 在Microsoft.Lync.Model.Conversation.AudioVideo.VideoWindow.set_Owner(Int32值) 在 AudioVideoConversation.ConversationWindow.ShowVideo(PanelvideoPanel、VideoWindow videoWindow) 在 c:\Program Files(x86)\Microsoft Office2013\LyncSDK\samples\AudioVideoConversation\Conversation\ConversationWindow.cs:line1128

A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Lync.Model.dll System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.Office.Uc.VideoWindowClass.set_Owner(Int32 Owner) at Microsoft.Lync.Model.Conversation.AudioVideo.VideoWindow.set_Owner(Int32 value) at AudioVideoConversation.ConversationWindow.ShowVideo(Panel videoPanel, VideoWindow videoWindow) in c:\Program Files (x86)\Microsoft Office 2013\LyncSDK\samples\AudioVideoConversation\Conversation\ConversationWindow.cs:line 1128

参考资料:UISuppression 视频问题

来自 Lync API 工程团队的澄清:未经授权的分配所有者时可能会遇到的访问(或 COM)异常通过复制示例项目来解决 VideoWindow 的句柄从 \Program Files(x86)... 文件夹到用户文件夹.编译并在用户文件夹中运行该项目,您将不会得到例外.

A clarification from the Lync API engineering team: The unauthorized access (or COM) exception that you may get when assigning an owner handle to the VideoWindow is resolved by copying the sample project out of the \Program Files(x86)... folder to a user folder. Compile and run the project in the user folder and you will not get an exception.

这篇关于Lync API - CaptureVideoWindow 和 RenderVideoWindow 为 Null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆