Change the Source

Jul 3, 2009 at 4:51 AM

I need to change the currenly playing file. When I stop the player can restart it, its not playing



 Change the Media Source


Oct 13, 2009 at 4:51 PM

No problem -- this can be achieved quickly and easily in a number of ways:)

One option is simply to use JavaScript. You can take full control of a Silverlight app using JavaScript. For example, you can access the methods and properties of MediaElement to set the source and play, and indeed bind JavaScript functions to events:-

Anything you can do in C# code, you can pretty much do in JavaScript too. Kneel before the power and versatility of Silverlight! ;)

Perhaps the simplest way, though not the best for performance, would be to use JavaScript to destroy and re-create your instance of the embedded Silverlight app on the page, setting the value of the m initParam as you do it.

If you need a hand, just let me know.