简体   繁体   English

如何在 UWP 中添加 mediaplayerelements 控件

[英]How to add mediaplayerelements controls in UWP

您如何在MediaPlayerElement上启用基本按钮控件(例如播放暂停快进等高级功能)?

MediaPlayerElement already have all the basic controls to Pause/Play , Stop , FastForward etc. you just need to set the AreTransportControlsEnabled = true and you will have all the basic controls on your mediaplayerelement. MediaPlayerElement已经有了所有的基本控制,以暂停/播放停止快进等,你只需要设置AreTransportControlsEnabled = TRUE,你将有你的mediaplayerelement所有的基本控制。

<MediaPlayerElement x:Name="mediaPlayer"
          Source="ms-appx:///Media/video1.mp4"
          AreTransportControlsEnabled="True" />

and to enable FastForward like buttons on it you can explicitly enabled them on your MediaTransportControls like this :并在其上启用类似FastForward 的按钮,您可以像这样在MediaTransportControls上显式启用它们:

<MediaPlayerElement x:Name="mediaElement1" Source="ms-appx:///Assets/audio.wma"
          AreTransportControlsEnabled="True">
    <MediaPlayerElement.TransportControls>
        <MediaTransportControls IsZoomButtonVisible="False"
                                IsFastForwardButtonVisible="True"
                                IsPlaybackRateButtonVisible="True" IsPlaybackRateEnabled="True"/>
    </MediaPlayerElement.TransportControls>
</MediaPlayerElement>

you can notice apart from fastforward button there are many other buttons to enable advanced features as well like playbackrate button and zoombutton.您可以注意到除了快进按钮之外,还有许多其他按钮可以启用高级功能以及播放速率按钮和缩放按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM