gpt4 book ai didi

c# - Lync API - CaptureVideoWindow 和 RenderVideoWindow 为空

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:19 25 4
gpt4 key购买 nike

我已经下载了适用于 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 中工作

最佳答案

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

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

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

这是 ConversationWindow.cs 的问题:第 1128 行...

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

这里是错误:

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 Video Issues

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.

关于c# - Lync API - CaptureVideoWindow 和 RenderVideoWindow 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16524693/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com