The MediaElement
In Silverlight, all the audio and video functionality is built into a single class: MediaElement.
Like all elements, a media element is placed directly in your user interface. If you're using the MediaElement to play audio, this fact isn't important, because the MediaElement remains invisible. If you're using the MediaElement for video, you place it where the video window should appear.
A simple MediaElement tag is all you need to play a sound. For example, add this markup to your user interface:
<MediaElement Source="test.mp3"></MediaElement>
Now, once the page is loaded, it will download the test.mp3 file and begin playing it automatically.
Of course, for this to work, your Silverlight application needs to be able to find ...
Get Pro Silverlight 5 in VB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.