Search code examples
c#xamlmedia-playerwindows-10http-live-streaming

MediaPlayer on Windows 10 XAML Error 'Windows.Media.Streaming.Adaptive.AdaptiveMediaSource' is not registered


I am getting an error when I am trying to play a HLS url in my Windows10 app, has anyone been having the same issue as I am?

Error that I am getting when calling CreateFromUriAsync:

Requested Windows Runtime type 'Windows.Media.Streaming.Adaptive.AdaptiveMediaSource' is not registered.

I have the Microsoft HLS SDK for WIndows Referenced.

My code very simple as you can see:

 private async Task GetVideoById(string videoId)
        {
            try
            {
                var hlsUri = new Uri("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");

                var hlsSource = await AdaptiveMediaSource.CreateFromUriAsync(hlsUri);

                if (hlsSource.Status == AdaptiveMediaSourceCreationStatus.Success)
                {
                    DmPlayer.SetMediaStreamSource(hlsSource.MediaSource);
                }
            }
            catch (Exception ex)
            {
                var error = ex;
            }
        }

My XAML:

<playerFramework:MediaPlayer x:Name="DmPlayer"
                                     Grid.Row="0"
                                     MinWidth="400"
                                     MinHeight="200"
                                     MaxHeight="400"
                                     HorizontalAlignment="Center"
                                     VerticalAlignment="Center"
                                     AutoPlay="True"
                                     IsFullScreenEnabled="True"
                                     IsFullScreenVisible="True"
                                     IsPlayPauseVisible="True"
                                     IsTimeElapsedVisible="True"
                                     IsTimeRemainingVisible="True"
                                     IsVolumeVisible="False"
                                     SeekWhileScrubbing="True"
                                     Stretch="Uniform"
                                     d:LayoutRounding="Auto">
        <playerFramework:MediaPlayer.RenderTransform>
            <CompositeTransform x:Name="PlayerTransform" />
        </playerFramework:MediaPlayer.RenderTransform>
        <playerFramework:MediaPlayer.Plugins>
        </playerFramework:MediaPlayer.Plugins>
    </playerFramework:MediaPlayer>

Edit:

Cmd > systeminfo:

Host Name: DESKTOP-7T9I942

OS Name: Microsoft Windows 10 Pro N

OS Version: 10.0.10586 N/A Build 10586


Solution

  • The issue is related to my Build... I have tried this code on a laptop running Windows 10 Build 10240 and another running Windows 10 Build 10569 and I had no issues. This happened after I did the Windows 10 threshold 2 update, so I recommend to NOT do that update.