How to Embed a .wmv file in HTML

By

"How can I embed a .wmv file in the HTML of my Web page?"

If you want to embed a WMV file in your Web page, you need to use some custom HTML code. There are a few specific parameters to set, to specify which Windows Media Player is used on the page, whether the file starts playing automatically or not, and how it displays with other elements on the page. You also need to consider compatibility issues for people viewing with different browsers and operating systems.

Most of the potential headaches you might run into involve support for browsers like Firefox, Chrome, and Safari. Mac users don't have Windows Media Player installed by default and must download Flip4mac in order to watch WMV files. Windows users get the best experience from Internet Explorer, which handles embedded Windows Media files without any additional components.Using the version 6.4 embedded player (which has nothing to do with the version of desktop player the user might have installed) provides the widest compatibility for all browsers.

When you setup your embed wmv file, there are some required parameters and additional optional parameters. You can copy the code example below, replacing the text http://yourdomain/yourmovie.wmv with the actual URL of your WMV file.

<object id="MediaPlayer" width=320 height=286 classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">

<param name="filename" value="http://yourdomain/yourmovie.wmv">
<param name="Showcontrols" value="True">
<param name="autoStart" value="True">
<param name="wmode" value="transparent">

<embed type="application/x-mplayer2" src=http://yourdomain/yourmovie.wmv" name="MediaPlayer" autoStart="True" wmode="transparent" width="320" height="286" ></embed>

</object>

Be sure to close the whole thing with that ending </obeject> tag.

The wmode="transparent" parameter makes sure that any menus on your site will display properly over the top of the video. The autoStart="True" starts the video automatically. You can change autoStart="False" if you don't want the file to start automatically. Notice that all parameters are defined in two places, which is because different browsers read the information in slightly different ways.