本文介绍了Windows Surface上的Silverlight 5 Vedio Capture问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个用于图像捕获的银色灯光应用程序,但是当我在表面启动相机时,会出现错误,错误信息如下所示

I create a silver light application for Image capture, But when start the Camera in my surface, it will occurs an error, the error message as below

Unhandle error in silverlight应用程序

Unhandle error in silverlight application

[Arg_argumentException]

[Arg_argumentException]

调试资源字符串不可用。通常,密钥和参数提供了足够的信息来诊断问题。请参阅http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.10411.00&File=mscorlib.dll&Key=Arg_ArgumentException

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.10411.00&File=mscorlib.dll&Key=Arg_ArgumentException

此错误并非总是发生,大多数时候我将新版本的XAP文件复制到serface。

This error not always occurs, most time when I copy the new version of XAP file to the serface.

代码如下:

 private void InitializeCamera()
        { 
            _captureSource = new CaptureSource();
            _captureSource.CaptureImageCompleted += new EventHandler<CaptureImageCompletedEventArgs>(captureSource_CaptureImageCompleted);
            _captureSource.CaptureFailed += new EventHandler<ExceptionRoutedEventArgs>(captureSource_CaptureFailed);

            VideoBrush videoBrush = new VideoBrush();
            videoBrush.Stretch = Stretch.Uniform;
            videoBrush.SetSource(_captureSource);
            BushRectagle.Fill = videoBrush;

            if (CaptureDeviceConfiguration.AllowedDeviceAccess ||
                 CaptureDeviceConfiguration.RequestDeviceAccess())
            {
                _captureSource.Start();
            }
        }


错误发生在代码中:_captureSource.Start();

The error was occurs in the code: _captureSource.Start();

推荐答案

> ;>调试资源字符串不可用。通常,密钥和参数提供了足够的信息来诊断问题。请参阅http://go.microsoft.com/fwlink/?linkid=106663&Version=5.0.10411.00&File=mscorlib.dll&Key=Arg_ArgumentException

取决于根据我在Silverlight中的经验,按照这些步骤保持您的项目可调试。

Depending on my experience in Silverlight following these steps keep your project debuggable.

条件1>

首先,我们需要确保在Web Project的属性中是一个Web部分,如下所示,必须选中Silverlight复选框。

Firstly we need to be ensure that in Web Project's properties there is a Web section, as you see below Silverlight checkbox must be checked.

条件2>关注菜单Debug =>附加调试器>

Condition 2> Follow In Menu Debug => Attach Debugger>

Visual Studio有时无法附加您需要引导的调试平台:)。通过这种方式,您可以调试其他平台,(您也可以调试您的产品平台,但pdb文件必须同步,不要忘记您可以使用
暂停您的产品平台)。

Visual Studio sometimes can't attach debugging platform you need to lead the way :) . By this way you may debug other platforms,(also you may debug your product platform but pdb files must be sync and don't forget you may suspend your product platform using this).

条件3>您的默认Web浏览器可能是Firefox,Chrome或IE以外的版本。通过Visual Studio默认尝试附加到IE。但是当您运行VS调用默认浏览器时,您需要在条件2中拥有手动附件,或者通过
设置默认浏览器,右键单击默认页面>浏览。

Condition 3> Your default web browser may be Firefox,Chrome or other than IE.By Visual Studio default try to attach to IE. But when you run VS calls default browser,so you need to have a manual attachment in Condition 2 or set your default browser by right clicking on default page > Browse with .

条件4> xap文件通常位于web project \ClientBin目录中。有时在构建操作之后,无法替换此文件,并且ProjectDll和Project PDB文件不同步。这会在调试时导致错误的行匹配或
无法找到附加警告的调试文件。我强烈建议删除总线项目中的所有生成的文件并删除Clientbin \ ProjectName.xap文件。重建之后一切都一定没问题!

Condition 4> There is xap file generally located in web project\ClientBin directory. Sometimes after build operations this file can't be replaced and your ProjectDll and your Project PDB files not be sync. This cause wrong line match while debugging or can't find a debugging file attached caution. I strongly suggest delete all generated files in Bus project and delete Clientbin\ProjectName.xap file. After rebuild all it must be ok!

另请尝试检查以下文章:

#如何从网络摄像头捕获音频和视频:

http://blogs.msdn.com/b/innov8showcase/archive/2010/01/11/silverlight-4-how-to-capture-audio-and-video-from -a-web-cam.aspx


#SilverLight:如何从网络摄像头录制视频:

http://stackoverflow.com/questions/12331783/silverlight-how-to-record-a-video-from-a-web-camera

Also please try to check these articles:
#How to Capture Audio and Video from a Web Cam:
http://blogs.msdn.com/b/innov8showcase/archive/2010/01/11/silverlight-4-how-to-capture-audio-and-video-from-a-web-cam.aspx .
#SilverLight: How to record a video from a web camera:
http://stackoverflow.com/questions/12331783/silverlight-how-to-record-a-video-from-a-web-camera .


这篇关于Windows Surface上的Silverlight 5 Vedio Capture问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 00:09