Display Current Video in Windows Phone 8 using Aud

2019-07-20 19:04发布

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?

2条回答
做个烂人
2楼-- · 2019-07-20 19:36

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

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-07-20 19:50

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.

查看更多
登录 后发表回答