Windows Phone 7.x |当应用程序转到后台时,如何正确关闭/暂停视频录制

时间:2013-08-07 20:39:54

标签: c# windows-phone-7 video-capture video-recording

当我在视频录制过程中锁定手机时,我的应用程序挂起了堆栈跟踪,如下所示:

  

System.Windows.dll!MS.Internal.NativePhotoMethods.CapMan_Disconnect(int dwSeq)
      System.Windows.dll!System.Windows.Media.CaptureSource.CaptureThread()+ 0x2dd bytes       mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper(System.Threading.ThreadHelper t)+ 0x1d bytes
      mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(对象状态)+ 0xb字节
      mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext,System.Threading.ContextCallback callback,object state)+ 0x63 bytes
      mscorlib.dll!System.Threading.ThreadHelper.ThreadStartHelper()+ 0x2a bytes

当我拨打captureSource.Stop()时(在锁定事件PhoneApplicationFrame.Obscured上),我的应用程序挂起了不同的堆栈跟踪:

  

mscorlib.dll中!System.Threading.Thread.Join()       System.Windows.dll!System.Windows.Media.CaptureSource.StopManagedImageCapture()+ 0x3e bytes
      System.Windows.dll!System.Windows.Media.CaptureSource.Stop()+ 0x10 bytes
    HelloWorld.dll!HelloWorld.App.RootFrame_Obscured(object sender,Microsoft.Phone.Controls.ObscuredEventArgs e)第96行+ 0xa字节C#       Microsoft.Phone.dll!System.Windows.Controls.Frame.FireEventHandler(System.EventHandler handler,object sender,Microsoft.Phone.Controls.ObscuredEventArgs args)+ 0xd bytes       Microsoft.Phone.dll!Microsoft.Phone.Controls.PhoneApplicationFrame.ShellPageManager_OnLockStateChange(object sender,Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs args)+ 0x48 bytes
      Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell.Interop.ShellPageManager.ShellPageCallback_OnLockStateChange(object source,Microsoft.Phone.Shell.Interop.LockStateChangeEventArgs e)+ 0x12 bytes
      Microsoft.Phone.Interop.dll!Microsoft.Phone.Shell.Interop.ShellPageCallback.FireOnLockStateChange(bool fLocked)+ 0x41 bytes
      [外部代码]

如何防止挂起并正确暂停/关闭CaptureSource

1 个答案:

答案 0 :(得分:-1)

尝试为Windows Phone实现模糊的事件

这是Obscured Event的链接

当屏幕覆盖应用程序时会触发此事件。尝试停止/暂停视频。看看它是否有效。如果没有,请留下回复