簡體   English   中英

僅在一台PC上例外,在其他PC上工作正常

[英]Exception only in one PC, in others work fine

我只有一台PC例外,在其他PC上一切正常,有人知道它是怎么來的嗎?

附加信息:請求的Windows運行時類型'Windows.Media.Capture.MediaCapture'未注冊。

僅在Windows 8.1中的現代風格應用程序(Windows strore應用程序)中顯示此例外。 在WPF或Windows Form應用程序中,相機可以正常工作。 代碼很好,因為在其他PC上效果很好:)我又安裝了一次系統,但仍然顯示異常。

查看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;
}

因此,您必須安裝“媒體播放器組件”。

我剛剛在Windows 10上遇到了這個問題。我已經安裝了N版本,但是由於缺少Media Player,因此看起來像MediaCapture相關的類也丟失了。 正如Hans Passant所述,MediaCapture類未在HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Microsoft \\ WindowsRuntime \\ ActivatableClassId中注冊。

我重新安裝了Windows 10(不是N版本),現在注冊了該類。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM