1
我使用下面的代碼使用PhotoCaptureDevice選項拿卡中的Windows Phone 8圖像捕捉設備不顯示任何
if (PhotoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Back) ||
PhotoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Front))
{
// Initialize the camera, when available.
if (PhotoCaptureDevice.AvailableSensorLocations.Contains(CameraSensorLocation.Back))
{
// Use the back camera.
System.Collections.Generic.IReadOnlyList<Windows.Foundation.Size> SupportedResolutions =
PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Back);
Windows.Foundation.Size res = SupportedResolutions[0];
d = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Back, res);
}
else
{
// Otherwise, use the front camera.
System.Collections.Generic.IReadOnlyList<Windows.Foundation.Size> SupportedResolutions =
PhotoCaptureDevice.GetAvailableCaptureResolutions(CameraSensorLocation.Front);
Windows.Foundation.Size res = SupportedResolutions[0];
d = await PhotoCaptureDevice.OpenAsync(CameraSensorLocation.Front, res);
}
await d.SetPreviewResolutionAsync(new Windows.Foundation.Size(640, 480));
await d.SetCaptureResolutionAsync(new Windows.Foundation.Size(640, 480));
d.SetProperty(KnownCameraGeneralProperties.EncodeWithOrientation,
d.SensorLocation == CameraSensorLocation.Back ?
d.SensorRotationInDegrees : -d.SensorRotationInDegrees);
_device = d;
}
最後我該設備設置爲視頻刷的來源。但是當應用程序通過按住後退鍵進入該狀態時,我會從休眠狀態進入休眠狀態,顯示空白頁並且不顯示任何攝像機。你能請任何人幫助我嗎?
它將在我們從休眠狀態進入時重新初始化VideoBrush時起作用。 –
嗨賈斯汀,有沒有什麼辦法來改變預覽和捕捉分辨率。如果我設置了一些值,它會引發異常。你能幫我解決這個問題嗎? –