Windows 10上的MediaPlayer XAML错误';Windows.Media.流媒体.自适应.Ada
本文关键字:Windows Media 流媒体 Ada 自适应 上的 MediaPlayer XAML 错误 | 更新日期: 2023-09-27 18:22:15
当我试图在Windows10应用程序中播放HLS url时遇到错误,有人和我一样遇到过同样的问题吗?
调用CreateFromUriAsync:时出错
Requested Windows Runtime type 'Windows.Media.Streaming.Adaptive.AdaptiveMediaSource' is not registered.
我有用于引用的WIndows的Microsoft HLS SDK。
正如你所看到的,我的代码非常简单:
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;
}
}
我的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>
编辑:
Cmd>systeminfo:
主机名:DESKTOP-7T9I942
操作系统名称:Microsoft Windows 10 Pro N
操作系统版本:10.0.10586 N/A Build 10586
该问题与我的Build。。。我在运行Windows 10 Build 10240的笔记本电脑和另一台运行Windows 10 Build10569的笔记本电脑上尝试过这个代码,我没有遇到任何问题。这是在我更新Windows 10阈值2之后发生的,所以我建议不要更新。