Is it possible to play an online video/audio media file inside a WinRT MediaElement
in a UWP App.
i tried to play a youtube video using this XAML code below but it fails:
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<MediaElement x:Name="_MediaElement"
Source="https://www.youtube.com/watch?v=eegYeXSds2I"
Height="500"
Width="600"
AutoPlay="False" />
<StackPanel Grid.Row="1" Orientation="Horizontal"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Play" Click="Play_Click"/>
<Button Content="Pause" Click="Pause_Click"/>
<Button Content="Stop" Click="Stop_Click" />
</StackPanel>
</Grid>
The XAML above didn’t work and didn’t play the video i tried to play the video manually from the code behind using this code:
public MainWindow()
{
InitializeComponent();
Uri uri = new Uri("https://www.youtube.com/watch?v=eegYeXSds2I");
_MediaElement.Source = uri;
_MediaElement.Play();
}
But that didn’t work as well, please Help.