我用MediapCapture扫描QrCode。这是我的配置:
var cameras = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
int cameraIndex = cameras.Count > 1 ? 1 : 0;
MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings { VideoDeviceId = cameras[cameraIndex].Id };
settings.StreamingCaptureMode = StreamingCaptureMode.Video;
await _mediaCapture.InitializeAsync();
SetResolution();
_mediaCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
_mediaCapture.VideoDeviceController.FocusControl.Configure(new Windows.Media.Devices.FocusSettings() { Mode = Windows.Media.Devices.FocusMode.Auto });
videoCapture.Source = _mediaCapture;
await _mediaCapture.StartPreviewAsync();我的CaptureElement上还有一个被点击的事件,它调用FocusAsync方法:
await _mediaCapture.VideoDeviceController.FocusControl.FocusAsync();我的问题是,当我试图集中注意力时,有时(并不总是)有一个错误(即使这是我第一次调用它)。此错误是:
op是无效的
编辑:
下面是我的堆栈跟踪:(没有内部异常)
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task任务)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task任务)在System.Runtime.CompilerServices.TaskAwaiter.GetResult() at ProjectName.Views.QrCodeScannerPage.d__8.MoveNext()
发布于 2016-07-15 12:10:32
https://stackoverflow.com/questions/38357474
复制相似问题