A common theme in media applications and services running inside Windows XP Media Center Edition is displaying metadata (Track Name, Artist, Album, etc.). Media Center APIs make it pretty easy to get this information without the use of an embedded Windows Media Player object in the HTML page. In addition, the service might want to detect what actions the user takes in controlling media transport (Play, Pause, Stop, etc).
The sample code for this post...
- Uses the PlayMedia Method with an audio playlist (.ASX) to play a couple of audio tracks (yours truly reading two toddler books for my youngest daughter to listen to whenever I'm not around :-).
- Traps and evaluates the onPlayStateChange event.
- Queries the PlayState property to display the current state of playback in the page, updated any time the playback state changes.
The sample code also does the following, depending on what you comment / uncomment in PlayStateChange.htm.
- Leverages the Experience.MediaProperty property to get specific metadata by property name from the currently playing media. (Line 43)
and / or
- Enumerates the Experience.MediaProperties array and displays the metadata from the currently playing media. (Line 46)