■ MediaPlayerElement 엘리먼트의 AutoPlay 속성을 사용하는 방법을 보여준다. ▶ MainWindow.xaml
|
<?xml version="1.0" encoding="utf-8"?> <Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="TestProject"> <MediaPlayerElement Name="mediaPlayerElement" Width="400" Height="300" AutoPlay="True" Source="ms-appx:///MEDIA/fishes.wmv" /> </Window> |
TestProject.zip
■ MediaPlayerElement 엘리먼트의 AreTransportControlsEnabled 속성을 사용하는 방법을 보여준다. ▶ MainWindow.xaml
|
<?xml version="1.0" encoding="utf-8"?> <Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="TestProject"> <MediaPlayerElement Name="mediaPlayerElement" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="300" AreTransportControlsEnabled="True" AutoPlay="False" Source="ms-appx:///MEDIA/ladybug.wmv" /> </Window> |
▶ MainWindow.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
using Microsoft.UI.Xaml; namespace TestProject { /// <summary> /// 메인 윈도우 /// </summary> public sealed partial class MainWindow : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWindow() /// <summary> /// 생성자 /// </summary> public MainWindow() { InitializeComponent(); this.mediaPlayerElement.MediaPlayer.Play(); } #endregion } } |
TestProject.zip
■ video 엘리먼트에서 비디오를 재생하는 방법을 보여준다. ▶ test.html
|
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> </head> <body> <video width="600" height="480" controls preload autoplay style="border:1px solid black;"> <source src="sample.mp4" type="video/mp4" /> </video> </body> </html> |
sample.mp4