首页 > 代码库 > MediaElement - 播放视频或音频的控件

MediaElement - 播放视频或音频的控件

<StackPanel Margin="0 50">
           
            <!--
                MediaElement 播放视频或音频的控件
               AreTransportControlsEnabled 是否显示默认控制条
              IsFullWindow  是否全屏显示播放器
                -->
            <MediaElement Name="mediaElement" Source="http://media.w3.org/2010/05/sintel/trailer.mp4"
                          Width="400" Height="300" HorizontalAlignment="Left"
                          AutoPlay="False"></MediaElement>

            <MediaElement Name="mediaElement2" Source="Assets\uwp05TypeConverters_high.mp4" Width="400" Height="300" HorizontalAlignment="Center"></MediaElement>
           
           
            <Button Name="btnFullScreen" Content="全屏播放" Click="btnFullScreen_Click" Margin="10"></Button>
           
        </StackPanel>

 

protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            mediaElement.AutoPlay = true;
            mediaElement.Play();
        }

 

MediaElement - 播放视频或音频的控件