MediaElement Sample Code
The sample for this section is a media viewer page, which allows you to specify a URL to a media file and view and/or listen to the file. This sample demonstrates the main features of the
MediaElement and gives you a test bed for exploring the
MediaElement’s main properties and methods.
The sample code is located in the
MediaView page and
MediaViewModel class in the downloadable sample code.
MediaViewModel class uses four commands to toggle the playback state of the
MediaElement and to mute and unmute audio. When the
PlayCommand is executed, it updates the
PlayerState property, signaling to the view to begin playback. Likewise, the
PauseCommand signals to the view that playback should be paused, as shown in the following ...