XAML
<MediaElement x:Name="VideoDice" Grid.Row="2" Grid.Column="2" LoadedBehavior="Manual" MediaEnded="VideoDice_MediaEnded" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
C#
VideoDice.Source = new Uri("DiceMovies/Dice_2.mp4", UriKind.Relative); VideoDice.Height = 500; VideoDice.Width = 500; VideoDice.Play();
In your project for the Dice_2.mp4
file it's necessary to set Copy to Output Directory
property to Copy if newer
. Looks like your .mp4
file does not copied to the output directory automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.