C# Lync API-CaptureVideoWindow和RenderVideoWindow为空
我已经下载了Lync 2013的SDK,在C# Lync API-CaptureVideoWindow和RenderVideoWindow为空,c#,sdk,video-streaming,lync,C#,Sdk,Video Streaming,Lync,我已经下载了Lync 2013的SDK,在AudioVideoConversation.csproj中找到的代码示例有问题。本项目旨在通过Lync API演示音频/视频对话的使用。我很难让视频部分在示例应用程序中正常工作。问题在于这种方法: /// <summary> /// Called when the video state changes. /// /// Will show Incoming/Outgoing video based on
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);
}
}));
}
//
///当视频状态更改时调用。
///
///将根据频道状态显示传入/传出视频。
///
void videoChannel_StateChanged(对象发送方,ChannelStateChangedEventArgs e)
{
//将执行发布到UI线程中
this.BeginInvoke(新方法调用程序(委托)()
{
//使用视频频道状态更新状态栏
toolStripStatusLabelVideoChannel.Text=e.NewState.ToString();
//*****************************************************************************************
//视频内容
//
//仅当Lync客户端在UISuppressionMode中运行时,视频内容才可用。
//
//视频内容不能作为流直接访问,而是通过
//可以在任何面板或窗口中取消绘制的视频窗口。
//
//可以从videoChannel.CaptureVideoWindow访问传出视频
//当视频频道状态为Send或SendReceive时,该窗口将可用。
//
//可以从videoChannel.RenderVideoWindow访问传入视频
//当视频频道状态为接收或发送接收时,该窗口可用。
//
//*****************************************************************************************
//如果传出视频现在处于活动状态,则显示视频(仅在UI抑制模式下可用)
如果((e.NewState==ChannelState.Send
||e.NewState==ChannelState.SendReceive)和&videoChannel.CaptureVideoWindow!=null)
{
//在面板中显示视频
ShowVideo(panelOutgoingVideo、videoChannel.CaptureVideoWindow);
}
//如果传入视频现在处于活动状态,则显示视频(仅在UI抑制模式下可用)
如果((e.NewState==ChannelState.Receive
||e.NewState==ChannelState.SendReceive)和&videoChannel.RenderVideoWindow!=null)
{
//在面板中显示视频
ShowVideo(panelIncomingVideo、videoChannel.RenderVideoWindow);
}
}));
}
变量videoChannel.CaptureVideoWindow
和videoChannel.RenderVideoWindow
始终为空(请注意,与videoChannel
不同,变量不为空)
有些事情你应该知道:
UISuppressionMode
[DWORD]添加为1来实现)e.NewState==ChannelState.SendReceive
计算结果为true
//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(视频窗口)
(x86)\Microsoft Office
2013\LyncSDK\samples\AudioVideoConversation\Conversation\ConversationWindow.cs:line
1128
参考资料:
Lync API工程团队的澄清:未经授权的
分配所有者时可能出现的访问(或COM)异常
通过复制示例项目来解析VideoWindow的句柄
在\程序文件(x86)中。。。文件夹到用户文件夹。编撰
并在用户文件夹中运行该项目,您将不会获得
例外
你有没有想过?还没有。同时提出了这个项目=(因此,今天我在示例应用程序的默认目录
C:\Program Files\Microsoft Office\Office15\LyncSDK\samples\AudioVideoConversation
中运行了该应用程序,重现了这个问题,我不能重复了=(它对我来说工作正常,无需移动示例应用程序的位置。这里发生了什么?lolIt可能与目录的所有者有关。您(您的帐户)是C:\Program Files\Microsoft Office\Office15\LyncSDK\samples\AudioVideoConversation的所有者吗?我肯定拥有完全权限(包括“完全控制”和“取得所有权”),但我有同样的想法