【发布时间】:2014-06-03 11:56:15
【问题描述】:
我想构建一个应用程序,让用户可以选择视频录制的分辨率大小(例如全高清 1920x1080 或 vga-640x480 等)
我正在使用下面的代码,但是当我在 720p 模拟器上运行它时,它会显示位于 else 部分的消息,即相机不支持这个。 (当我将值 800,450 更改为 640,480 时相机开始正常工作)
try
{
//string deviceName = DeviceStatus.DeviceName;
//var deviceName = DeviceStatus.DeviceName;
//if (deviceName.Contains("RM-885"))
//{
Windows.Foundation.Size initialResolution = new Windows.Foundation.Size(800, 450);
Windows.Foundation.Size previewResolution = new Windows.Foundation.Size(800, 450);
Windows.Foundation.Size captureResolution = new Windows.Foundation.Size(800, 450);
if (AudioVideoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Back))
{
pops = await AudioVideoCaptureDevice.OpenAsync(CameraSensorLocation.Back, initialResolution);
await pops.SetPreviewResolutionAsync(previewResolution);
await pops.SetCaptureResolutionAsync(captureResolution);
}
}
// }
catch (Exception p) { Debug.WriteLine(p.Message); }
try
{
if(pops != null)
{
// create the videobrush for the viewfinder
videoRecordBrush = new VideoBrush();
videoRecordBrush.SetSource(pops);
// display the viewfinder image
viewfinderRectangle.Fill = videoRecordBrush;
//shows available resolution message
MessageBox.Show("statrt recording ");
MessageBox.Show(pops.PreviewResolution.ToString());
MessageBox.Show(pops.CaptureResolution.ToString());
}
else
{
MessageBox.Show("camera not support this ");
}
}
catch(Exception ex)
{
MessageBox.Show("exception" + ex);
}
}
这是在视频模式下更改分辨率的正确代码吗?还是有其他方法?
【问题讨论】:
标签: c# vb.net windows-phone-8 windows-phone