MediaElement - Windows Phone Controls |
MediaElement - Windows Phone Controls สำหรับ MediaElement เป็น Controls บน Windows Phone ที่ใช้สำหรับเล่นไฟล์ Media โดยรองรับได้ทั้ที่เป็น Video (ภาพ) และ Audio (เสียง) รองรับไฟล์ได้หลากหลายรูปแบบ เช่น mp3, mp4 , wmaและไฟล์อื่น ๆ อีกมากมาย โดยรองรับทั้งไฟล์ใน Local Source และจาก URL Source

XAML
<MediaElement .../>
Windows Phone Media Player (MediaElement) and DownloadProgress (URL,Website)
MediaElement Supported Media Formats - Windows Phone
Example ตัวอย่างการใช้ MediaElement บน Windows Phone
XAML

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<MediaElement Height="242" HorizontalAlignment="Left" Margin="92,109,0,0" Name="MediaElement1" VerticalAlignment="Top" Width="274" Source="/Media/vdo.mp4" />
</Grid>
</Grid>

เป็น Media Source ที่จัดเก็บไว้ใน local
Screenshot

แสดงไฟล์ Media บนหน้าจอของ App

|