How to get camera feeds in Windows 8 Metro style app?

瘦欲@ 提交于 2019-12-01 11:39:18
sarvesh

All you need to do is pass in CameraCaptureUIMode.Video for CaptureFileAsync. Here is a sample

CameraCaptureUI dialog = new CameraCaptureUI();
dialog.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

StorageFile file = null;
file = await dialog.CaptureFileAsync(CameraCaptureUIMode.Video);
if (file != null)
{

    IRandomAccessStream fileStream = await   file.OpenAsync(Windows.Storage.FileAccessMode.Read);
    //Do something with the stream
}

EDIT:

In order to apply effects you can use the AddEffectAsync method, for example.

mediaCaptureMgr.AddEffectAsync(MediaStreamType.VideoPreview, "Microsoft.Samples.GrayscaleEffect", null);

The Microsoft Foundation Transform (MFT) implementation of the GrayScaleEffect is [here]. 1. That example should allow you to create your own effects.

I blogged about it before.

You need to use a CaptureElement and a MediaCapture object:

var mediaCapture = new MediaCapture(); 
await mediaCapture.InitializeAsync(); 
this.captureElement.Source = mediaCapture; 
await mediaCapture.StartPreviewAsync(); 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!