How to change the resolution of camera while recording video in WP8

前端 未结 4 1823
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-25 09:19

I am using the video recording sample provided by microsoft here. I want to change the resolution of the video being recorded in my app. Currently its recording in highest resol

4条回答
  •  不要未来只要你来
    2021-01-25 09:33

    Use AudioVideoCaptureDevice to recoed video

    StorageFolder isoStore = await ApplicationData.Current.LocalFolder.GetFolderAsync("Shared");
                var file = await isoStore.CreateFileAsync("foos1.wmv", CreationCollisionOption.ReplaceExisting);
                using (var s = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    Windows.Foundation.Size resolution = new Windows.Foundation.Size(640, 480);
                    avDevice = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back,
                        AudioVideoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back).Last());
    
                    VideoBrush videoRecorderBrush = new VideoBrush();
                    videoRecorderBrush.SetSource(avDevice);
    
                    viewfinderRectangle.Fill = videoRecorderBrush;
    
                    await avDevice.StartRecordingToStreamAsync(s);
    
                    Thread.Sleep(30000);
    
    
                    await avDevice.StopRecordingAsync();
    
    
    
                }
    
    
                new MediaPlayerLauncher()
                {
                    Media = new Uri(file.Path, UriKind.Relative),
                }.Show();
    

提交回复
热议问题