0

I cant make the MediaElement object to work in page load. It works fine if I call

// the reason is during Page_load MyMediaElement.AudioStreamCount is 0
MyMediaElement.Stop();
MyMediaElement.Play();

in a button event. I checked my page_load but nothing seems to be preventing this. Is it because of some threading issue?

Even if I call it on Page_Loaded, it is not working

keyboardP
  • 68,824
  • 13
  • 156
  • 205
Kubi
  • 2,139
  • 6
  • 35
  • 62

1 Answers1

1

If you want the MediaElement to start playing as soon as possible, you can either set its AutoPlay property to true or try calling the Play method within the MediaOpened event.

keyboardP
  • 68,824
  • 13
  • 156
  • 205
  • does MediaOpened means that the MediaLoaded ? – Kubi Oct 21 '12 at 02:30
  • 1
    Yes, it will load the media file, ensure that its valid, and it'll read the headers. At this point, the `MediaOpened` event is fired and the media will is ready to play. – keyboardP Oct 21 '12 at 09:48