Share via


Compact Disc Audio Playback

Windows Media Player SDK banner art

The Windows Media Player control supports playback for Compact Disc (CD) audio. 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 a Windows Media metafile. 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 Windows Media metafile.

<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 metafiles, see the Windows Media Player SDK version 7 or later.