c# - 指定的对象或值不存在

标签 c# xaml uwp raspberry-pi3 windowsiot

我开发了一个 UWP 应用程序,它可以从网络摄像头捕获视频并将其保存到 UWP 的本地存储中,该应用程序在本地机器上运行良好,但是在将它部署到 RaspberryPi3 上后,我得到了 fo

The Specified Object or Value Does not Exist

文件正在保存到应用程序的本地数据。调试后我知道错误在以下几行:

MediaEncodingProfile recordProfile = null;
recordProfile = MediaEncodingProfile.CreateWmv(VideoEncodingQuality.Auto);

await _mediaCapture.StartRecordToStorageFileAsync(recordProfile, recordStorageFile);
_statuses.Add(DateTime.Now.ToString() + ": " + fileName + " Recording in progress");

如有任何帮助,我们将不胜感激。

最佳答案

The issue maybe due to your USB camera has no micro phone,  but the default capture mode is video and audio.

因此,在调用 MediaCapture.InitializeAsync() 之前,您需要像这样将 StreamingCaptureMode 设置为视频:

            var settings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
            settings.StreamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.Audio;
            await mediaCapture.InitializeAsync(settings);

关于c# - 指定的对象或值不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40819237/

相关文章:

c# - Wix:将数据从 ProgramFilesFolder 移动到 ProgramData

c# - 如何在nuget中使用外部别名

c# - 在 C# 中进行 cURL 调用

xaml - 将显示效果应用于 InkToolbar [UWP]

C# RenderTargetBitmap 到 SoftwareBitmap

C# 声明静态列表

c# - 如何在不使用 System.Drawing 的情况下生成颜色

c# - 停止 Xamarin.Forms 中的 IOS 弹跳

wpf - 一个 View 可以有两个 View 模型作为它的数据上下文吗?

wpf - Generic.xaml 有什么特别之处?