Windows Media Player Control SDK Banner Art
*Contents *Index  *Topic Contents
*Previous Topic: Error Handling
*Next Topic: Using DVD with the Windows Media Player Control

Compact Disc Audio Playback

The Microsoft® Windows Media™ Player control supports playback for Compact Disc (CD) audio. The Windows Media Player treats the CD as a single audio stream, with markers at the beginning of each track.

To use CD audio with the embedded Windows Media Player control, you need to set the FileName property to CDAUDIO: (with the trailing ":"). The following example shows how to do this.

<HTML>
<HEAD><TITLE>CD Audio Playback Example</TITLE></HEAD>
<BODY>

<OBJECT ID="MediaPlayer"
    CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
    WIDTH="320" 
    HEIGHT="508"
    STYLE="position:absolute; left:0px; top:70px;"
    >
    <PARAM NAME="FileName" VALUE="cdaudio:">
    <PARAM NAME="AutoStart" VALUE="0">
    <PARAM NAME="ShowControls" VALUE="1">
    <PARAM NAME="ShowStatusBar" VALUE="1">
    <PARAM NAME="ShowDisplay" VALUE="1">
</OBJECT>

</BODY>
</HTML>

Calling the Play method will then start playback of the CD. This does require that a compact disc be present in the computer of the person opening the Web page.

You can specify the playback order, and information about each track, in an Advanced Stream Redirector (ASX) file. Use a separate ENTRY element for each track, and denote tracks by specifying STARTMARKER and ENDMARKER values. For each ENTRY element, set the start marker equal to the marker at the beginning of the track, and set the end marker equal to the marker at the beginning of the next track. For the CD to play all the tracks in sequence, these values must connect together, as shown in the following example ASX file.

<ASX VERSION="3.0">
    <TITLE>CD Audio with the Media Player</TITLE>
    <AUTHOR>Windows Media Technologies</AUTHOR>
    <COPYRIGHT>(c) 1999, Microsoft, Inc.</COPYRIGHT>

    <ENTRY>
		<TITLE>Track 1: Title 1</TITLE>
		<REF HREF="cdaudio:" />
		<STARTMARKER NUMBER="1"/> 
		<ENDMARKER NUMBER="2"/> 
   </ENTRY>

    <ENTRY>
		<TITLE>Track 2: Title 2</TITLE>
		<REF HREF="cdaudio:" />
		<STARTMARKER NUMBER="2"/> 
		<ENDMARKER NUMBER="3"/> 
   </ENTRY>

    <ENTRY>
		<TITLE>Track 3: Title 3</TITLE>
		<REF HREF="cdaudio:" />
		<STARTMARKER NUMBER="3"/> 
		<ENDMARKER NUMBER="4"/> 
  </ENTRY>

    <ENTRY>
		<TITLE>Track 4: Title 4</TITLE>
		<REF HREF="cdaudio:" />
		<STARTMARKER NUMBER="4"/> 
   </ENTRY>
</ASX>

The first track is assigned a STARTMARKER value of 1 and an ENDMARKER value of 2, which stops audio playback when it reaches the second marker in the audio stream. Each of the tracks is chained together in this way until the last track of the CD, for which you should not specify an ENDMARKER.

For information on ASX files, see Using ASX Metafiles. For information on building faceplates for the Windows Media Player control, see the Faceplate Authoring Guide.


Top of Page Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.