I've try to play video on a page upon loaded by using mediaElement
here is the XAML code
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<MediaElement x:Name="mediaElement" AreTransportControlsEnabled="True" Width="400" />
</Grid>
and here is a C# code
public async void initVideo()
{
mediaElement.Source = new Uri("ms-appx:///Assets/sampleVideo.mp4");
mediaElement.Play();
}
The video I want to play resides in Assets folder. However when the page is loaded it gives Error:Unsupported Video type or Invalid file path
I've try with mp4 , flv, wmv file so it's unlikely that this is caused by unsupported video type
I've follow this example too https://msdn.microsoft.com/en-us/library/windows/apps/mt187272.aspx?f=255&MSPPError=-2147217396
but it's also causing same problem
Is there any error on my path? how to solved this? thanks in advance!!
Thanks everyone that try to help!! but I've found what goes wrong myself
At first I've copy my .mp4 file and paste to the Assets folder directly by file explorer. This case got an error
But when I copy my .mp4 file and paste in the Assets folder through Visual Studio it correctly can find a correct path now and playing the video correctly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With