[英]Exception only in one PC, in others work fine
I have an exception only in one PC, in others all work fine, anyone know wher it is comming from? 我只有一台PC例外,在其他PC上一切正常,有人知道它是怎么来的吗?
dditional information: Requested Windows Runtime type 'Windows.Media.Capture.MediaCapture' is not registered. 附加信息:请求的Windows运行时类型'Windows.Media.Capture.MediaCapture'未注册。
This exception is showing only in modern style apps (windows strore app) in windows 8.1. 仅在Windows 8.1中的现代风格应用程序(Windows strore应用程序)中显示此例外。 In WPF or Windows Form apps camera works fine. 在WPF或Windows Form应用程序中,相机可以正常工作。 Code is fine, because in other pc work great:) i install system one more time, but the exception still showing up. 代码很好,因为在其他PC上效果很好:)我又安装了一次系统,但仍然显示异常。
Looking at Microsoft's Windows Universal Samples ( https://github.com/Microsoft/Windows-universal-samples/blob/e13cf5dca497ad661706d150a154830666913be4/Samples/SpeechRecognitionAndSynthesis/cs/AudioCapturePermissions.cs#L35 ) shows following piece of code 查看Microsoft的Windows通用示例( https://github.com/Microsoft/Windows-universal-samples/blob/e13cf5dca497ad661706d150a154830666913be4/Samples/SpeechRecognitionAndSynthesis/cs/AudioCapturePermissions.cs#L35 )显示以下代码
try
{
// Request access to the microphone only, to limit the number of capabilities we need
// to request in the package manifest.
MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Audio;
settings.MediaCategory = MediaCategory.Speech;
MediaCapture capture = new MediaCapture();
await capture.InitializeAsync(settings);
}
catch (TypeLoadException)
{
// On SKUs without media player (eg, the N SKUs), we may not have access to the Windows.Media.Capture
// namespace unless the media player pack is installed. Handle this gracefully.
var messageDialog = new Windows.UI.Popups.MessageDialog("Media player components are unavailable.");
await messageDialog.ShowAsync();
return false;
}
So you have to install "Media player components". 因此,您必须安装“媒体播放器组件”。
I just had this issue with Windows 10. I had installed the N edition, but it looks like since it is missing Media Player, the classes related to MediaCapture are also missing. 我刚刚在Windows 10上遇到了这个问题。我已经安装了N版本,但是由于缺少Media Player,因此看起来像MediaCapture相关的类也丢失了。 As Hans Passant mentioned, the MediaCapture class was not registered in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\WindowsRuntime\\ActivatableClassId. 正如Hans Passant所述,MediaCapture类未在HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ WindowsRuntime \\ ActivatableClassId中注册。
I reinstalled Window 10 (not the N edition) and now the class is registered. 我重新安装了Windows 10(不是N版本),现在注册了该类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.