【问题标题】:Lync API - CaptureVideoWindow and RenderVideoWindow are NullLync API - CaptureVideoWindow 和 RenderVideoWindow 为 Null
【发布时间】:2013-05-07 15:25:42
【问题描述】:

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

    /// <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 始终为空(请注意,与this question 不同,videoChannel 变量不为空)。

你应该知道的一些事情:

  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

【问题讨论】:

  • 你有没有想过这个问题?
  • 还没有。同时提出该项目。 =(

标签: c# sdk video-streaming lync


【解决方案1】:

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

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

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

这是来自 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.dll 中 System.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(面板 c:\Program Files 中的 videoPanel、VideoWindow videoWindow) (x86)\微软办公室 2013\LyncSDK\samples\AudioVideoConversation\Conversation\ConversationWindow.cs:line 第1128章

参考资料: UISuppression Video Issues

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

【讨论】:

  • 所以,我今天通过在其默认目录C:\Program Files\Microsoft Office\Office15\LyncSDK\samples\AudioVideoConversation 中运行示例应用程序来重现该问题,但我无法重复它...... =(它对我来说很好,无需移动示例应用程序的位置。这是怎么回事??lol
  • 这可能与目录的所有者有关。您(您的帐户)是 C:\Program Files\Microsoft Office\Office15\LyncSDK\samples\AudioVideoConversation 的所有者吗?
  • 我绝对拥有完全权限(包括“完全控制”和“获得所有权”),但我在去年 5 月尝试此操作时拥有相同级别的权限。 事实上!,这与我发布问题时使用的 SDK 安装相同。我打开了项目的同一个副本,在同一个帐户下以同样的方式运行它。我无法理解会发生什么变化。
  • 嗯……现在我很困惑。我刚刚尝试使用 C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\samples\AudioVideoConversation\bin\Debug 中的 EXE,它也可以在这里工作。我将对此进行更深入的调查并回复您。
  • 您是否必须重新安装 SDK?如果是这样,您是否在重复该问题之前重新启动了您的 PC?我想知道它是否就这么简单。如果是这样,我会很难过。
猜你喜欢
  • 2011-09-17
  • 1970-01-01
  • 2011-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-06-17
  • 1970-01-01
相关资源
最近更新 更多