O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

The 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required