Windows Media Player 11 SDK Adding an Embedded Windows Media Player Control 

Windows Media Player SDK banner art
PreviousNext

Adding an Embedded Windows Media Player Control

There are two reasons you might consider adding an embedded instance of Windows Media Player to your HTMLView presentation. First, if you want to display video content, you need to use the Windows Media Player ActiveX control. Second, if you want to take advantage of features of the Windows Media Player object model from within your HTMLView Web page, you must use an instance the Player control to do so.

Using the Player control to display video in HTMLView content

Usually, Windows Media Player displays video using the Video and Visualization pane of the Now Playing feature. Since HTMLView uses this area to display your Web page, you must supply an additional video display area if you want the Player to play video. This is easy to do by using the Windows Media Player ActiveX control.

To use the Player control to display video, embed the control in your HTMLView Web page by using the OBJECT tag. This is the same technique you use to embed the Player control into any Web page in which you want to display video. The following example code shows the basic syntax for embedding the Player control in Internet Explorer:

<OBJECT id = "Player" 
    CLASSID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> 
        <PARAM Name = "autoStart"  Value = "true">
        <PARAM Name = "uiMode" Value = "none">
</OBJECT>

The autoStart parameter ensures that content plays automatically whenever a new URL is specified. The value you specify for uiMode is up to you, but you will usually want to specify "none" when creating content for HTMLView presentations. When you embed the Windows Media Player control to display video in this manner, the user can control playback using the controls of the full-mode Player, so there's no need to provide additional transport controls in the Web page. You can use the space you would usually allocate for transport controls to display more text, graphics, or links to other content.

Do not specify a URL parameter when embedding the Windows Media Player control in a Web page designed to display in an HTMLView presentation. Instead, specify the digital media files in the .asx file that opens the content.

Because you provide the video display region in your HTMLView Web page, you can decide where to position the video and how large you want the display region to be. For example, you can contain the Player object within an HTML DIV element and then specify the position for the DIV to situate the video display on the Web page. You can change the dimensions of the video display by specifying values for the height and width attributes of the OBJECT element. You can also specify these values using script code.

Using the Player object model

The Windows Media Player object model exposes properties, methods, and events that you can use in your HTMLView Web pages. When you embed the Windows Media Player ActiveX control in your HTMLView Web page, you automatically have access to the Player object model.

If you embed the Windows Media Player control in your HTMLView Web page, do not use the Player object model to specify the digital media file to be played. For example, if you use script code to specify a value for the URL property of the embedded control, your HTMLView Web page will be unloaded from the Now Playing feature when the digital media file plays. To prevent this from happening, always open .asx files that include HTMLView parameters when you need to use script to open digital media content from your HTMLView Web page.

See Also

PreviousNext
Show: