[UWP] [HTML]使用Windows.Media.Playback.MediaPlayer [英] [UWP][HTML]Using Windows.Media.Playback.MediaPlayer
问题描述
H
我正在尝试使用xbox上的原生媒体播放器。
I am trying to use the native media player on the xbox one.
我的代码是
My code is
    var mediaPlayer = Windows.Media.Playback.MediaPlayer();
    mediaPlayer.source = Windows.Media.Core.MediaSource.createFromUri(Windows.Foundation.Uri(url));
    mediaPlayer.autoPlay = true;
var mediaPlayer = Windows.Media.Playback.MediaPlayer();
mediaPlayer.source = Windows.Media.Core.MediaSource.createFromUri(Windows.Foundation.Uri(url));
mediaPlayer.autoPlay = true;
    mediaPlayer.play()// 未定义
mediaPlayer.play() // is undefined
我收到音频但没有视频。我如何添加视频?
I get audio but no video. How do i add the video?
推荐答案
如果你想要使用原生媒体播放器,您需要添加 MediaPlayerElement Class 在xaml文件中显示视频。
If you are tying to use native media player, you will need to add a MediaPlayerElement Class in the xaml file to show the video.
但正如您提到的标题,如果您使用的是HTML,则只需在html页面中添加视频标记即可设置视频源。
But as you title mentioned, if you are using HTML, you just need to add a video tag in the html page and set the video source.
此问题已在此处得到解答: [UWP] [HTML]使用Windows.Media.Playback.MediaPlayer 。你可以
参考@Elvis的回答。
This question has been answered here:[UWP][HTML]Using Windows.Media.Playback.MediaPlayer. You could refer @Elvis's answer as well.
祝你好运,
Roy
>
这篇关于[UWP] [HTML]使用Windows.Media.Playback.MediaPlayer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!