首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UWP MediaCapture FocusAsync: op无效

UWP MediaCapture FocusAsync: op无效
EN

Stack Overflow用户
提问于 2016-07-13 16:48:58
回答 1查看 693关注 0票数 1

我用MediapCapture扫描QrCode。这是我的配置:

代码语言:javascript
复制
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方法:

代码语言:javascript
复制
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()

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-15 12:10:32

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38357474

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档