Kubi
Kubi

Reputation: 2179

Silverlight MediaElement does not work during pageload

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

Upvotes: 0

Views: 151

Answers (1)

keyboardP
keyboardP

Reputation: 69372

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.

Upvotes: 1

Related Questions