0

I am trying to give a MediaElement a source when a button is clicked and then play the media, this is what I have so far:

In my XAML:

<MediaElement x:Name="vid" HorizontalAlignment="Left" Height="100" Margin="310,193,0,0" Grid.Row="1" VerticalAlignment="Top" Width="100" Source="Assets/Stars.mov"/>

In the class:

private void Button1_Click(object sender, RoutedEventArgs e)
    {
        this.vid.Source = new Uri("Assets/Stars.mov", UriKind.Relative);
        vid.Play();
    }

However I receive this error:

An exception of type 'System.ArgumentException' occurred in mscorlib.dll but was not handled in user code
Additional information: The given System.Uri cannot be converted into a Windows.Foundation.Uri. Please see http://go.microsoft.com/fwlink/?LinkID=215849 for details.

Does anyone know what I am doing wrong?

Jermain Defo
  • 189
  • 1
  • 1
  • 11