【发布时间】:2016-05-17 06:57:58
【问题描述】:
我在访问 IOT 摄像头时遇到问题, 我尝试创建访问相机的简单代码,从该相机查看实时流。 它适用于 Windows-phone 10 && Windows 10。 但在 IOT 设备上尝试时出现错误,显示“未找到设备” 相机就像here in this link
这里是代码
private async Task StartPreviewAsync()
{
try
{
mediaCapture = new MediaCapture();
var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
var count = allVideoDevices.Count;
System.Diagnostics.Debug.WriteLine(count+"Video Capture Device");
await mediaCapture.InitializeAsync();
PreviewControl.Source = mediaCapture;
await mediaCapture.StartPreviewAsync();
}
catch (UnauthorizedAccessException)
{
// This will be thrown if the user denied access to the camera in privacy settings
System.Diagnostics.Debug.WriteLine("The app was denied access to the camera");
}
catch (Exception)
{
System.Diagnostics.Debug.WriteLine("MediaCapture initialization failed.");
}
}
//protected async override void OnNavigatedFrom(NavigationEventArgs e)
//{
// await CleanupCameraAsync();
//}
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
StartPreviewAsync();
}
对我的问题有什么建议吗?
【问题讨论】: