Windows Media Player SDK banner art
PreviousNext

Embedding the Windows Media Player

This topic applies to Windows Media Player version 6.4 only.

The remainder of the file displays the faceplate title and positions the Windows Media Player control in the page. The complete sample code follows.

<HTML>
<HEAD>
    <SCRIPT>
        window.resizeTo(330,448);
    </SCRIPT>

    <TITLE>Media Player Faceplate</TITLE>

    <HTA:APPLICATION 
        CAPTION="true"
        MAXIMIZEBUTTON="no"
    >
</HEAD>

<BODY SCROLL="no">

<CENTER>
    <B>A Simple Faceplate</B>
</CENTER>

<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="../art/media/lunchtime.asf">
    <PARAM NAME="AutoStart" VALUE="0">
    <PARAM NAME="ShowControls" VALUE="1">
    <PARAM NAME="ShowStatusBar" VALUE="1">
    <PARAM NAME="ShowDisplay" VALUE="1">
</OBJECT>

</BODY>
</HTML>

Setting the SCROLL attribute of the BODY tag to no eliminates the scroll bars from the page, which maximizes the usable area of the faceplate. The faceplate title is simply HTML text centered at the top of the page. The OBJECT tag creates an instance of the Windows Media Player control with all standard interface controls enabled. The STYLE attribute provides precise positioning.

The Windows Media Player control object is initialized with a series of PARAM tags that set the values of several properties. The most important of these is the FileName property, which specifies which file the Windows Media Player will use for playback. The file can be a single media file (such as a file with an .avi or .asf file name extension), or a Windows Media metafile that lists several media files to be played in a certain order. The AutoStart property is set to zero, indicating that Windows Media Player should not start playing the file right away. Finally, the ShowControls, ShowStatusBar, and ShowDisplay properties indicate that Windows Media Player should display its standard user interface, in order for the user to control and monitor playback from the Web page.

PreviousNext


© 2000-2001 Microsoft Corporation. All rights reserved.