尝试使用以下代码将 PhotoCamera 设置为 VideoBrush 的源时出现上述错误:
camera = new PhotoCamera();
var videoBrush = new VideoBrush();
videoBrush.SetSource(camera);
AR.Background = videoBrush;
我得到以下堆栈跟踪:
0x80131515
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.VideoBrush_SetExternalVideoSource(VideoBrush vb, IntPtr& videoSessionHandle)
at System.Windows.Media.VideoBrush.SetUpExternalVideoSession()
at Microsoft.Devices.CameraVideoBrushExtensions.SetSource(VideoBrush brush, Camera camera)
at MyClass.MyFunction()
at System.Windows.Controls.Frame.FireEventHandler[T](EventHandler`1 handler, Object sender, OrientationChangedEventArgs args)
at Microsoft.Phone.Controls.PhoneApplicationPage.UIOrientationChange(ShellPageOrientation orientation)
无论我是否附加了调试器,都会引发异常。
谢谢。