Display Current Video in Windows Phone 8 using AudioVideoCaptureDevice?

时光怂恿深爱的人放手 提交于 2019-12-24 02:33:47

问题


I've managed to setup code for a Windows Phone 8 Application that initializes and can start/stop recording video using an AudioVideoCaptureDevice. (saves it to an IRandomAccessStream)

//Initialize Camera Recording
Windows.Foundation.Size resolution = new Windows.Foundation.Size(640, 480);
captureDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, resolution);
captureDevice.VideoEncodingFormat = CameraCaptureVideoFormat.H264;
captureDevice.AudioEncodingFormat = CameraCaptureAudioFormat.Aac;
captureDevice.RecordingFailed += captureDevice_RecordingFailed;

However, I cannot figure out how to hook this recording up to a VideoBrush to display the recording to the user. I want the user to be able to see the video they are recording as it is happening...

I know there is a tutorial that shows how to do this using the old APIs for Windows Phone 7 (CaptureSource, VideoDevice, etc.) but I specifically need to use the AudioVideoCaptureDevice to record. Anyone know how to display this video on screen?


回答1:


Well, I was able to solve my problem.

Apparently there is a library in Microsoft.Devices that contains extensions for the VideoBrush class. Therefore, in order to set the videobrush source to an AudioVideoCaptureDevice, you must first have:

using Microsoft.Devices;

at the top of your class in which your using the videobrush. Hope this is able to help someone else.




回答2:


You should be able to simply use VideoBrush.SetSource(captureDevice).



来源:https://stackoverflow.com/questions/16906456/display-current-video-in-windows-phone-8-using-audiovideocapturedevice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!