Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Lync API-CaptureVideoWindow和RenderVideoWindow为空_C#_Sdk_Video Streaming_Lync - Fatal编程技术网

C# Lync API-CaptureVideoWindow和RenderVideoWindow为空

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

我已经下载了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);
            }

        }));
    }
//
///当视频状态更改时调用。
/// 
///将根据频道状态显示传入/传出视频。
/// 
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
不同,变量不为空)

有些事情你应该知道:

  • 我正在UI抑制模式下运行Lync(通过在HKEY\U CURRENT\U USER\Software\Microsoft\Office\15.0\Lync位置将注册表项
    UISuppressionMode
    [DWORD]添加为1来实现)
  • 示例的音频部分工作正常
  • 该示例实际上成功地将我的视频流发送到远程方
  • 对话设置完成后,
    e.NewState==ChannelState.SendReceive
    计算结果为
    true
  • 我在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();
    
    以下是错误:

    “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的所有者吗?我肯定拥有完全权限(包括“完全控制”和“取得所有权”),但我有同样的想法