0

I am trying to play a Viddler video in my application but i cant get it to work. Here is my simple code:

XAML:

  < MediaElement VerticalAlignment="Center" Visibility="Visible" 
    HorizontalAlignment="Center"
    Name="myMediaElement" Height="350" 
    Width="640" />

And my c#:

myMediaElement = new MediaElement();
Uri url = new Uri("http://www.viddler.com/embed/5b17d44f/");
myMediaElement.Source = url;
myMediaElement.Play();

Any help would be great! When i arrive on the page, nothing happens, the application does not break it just does nothing....

Edit: In the end I have just decided to call the http://www.viddler.com/embed/5b17d44f/ url into a Webview, its not the best idea but it works.

Damien
  • 2,911
  • 1
  • 25
  • 47
  • What exactly happens when you run your code? Furthermore are you 100% postive that `MediaElement` even contained within the WinRT .NET Profile. Based on my research `MediaElement` cannot be used within an application being targeted against the `WinRT .NET Profile` you will have to develop your own solution. – Security Hound Nov 01 '12 at 17:09
  • When I run my code nothing happens, it would seem that I am missing something, on the SDK tutorial of MS they show examples of using the MediaElement but they use it with a FileOpenPicker module. – Damien Nov 02 '12 at 16:24

1 Answers1

0
  1. Dont create a new MediaElemet. You already have one created (XAML).
  2. Set AutoPlay="True" in your XAML

Edit: Play works only if the media is already loaded.

Yann Olaf
  • 597
  • 3
  • 12
  • Thanks for your answer but it doesn't seem to fix my problem, I think that i need to download the video on the device and then play it, because playing it directly from an url does not seem possible. – Damien Nov 07 '12 at 08:46