Windows Media Video (WMV) format is a popular video codec format developed by Microsoft, which supports Internet streaming applications, WMV Screen and WMV Image, and is now mandatory video codec for HD DVD and Blu-ray Disc (BD-ROM), plus PlaysForSure-certified online stores and devices. WMV is also the only supported video codec for the Microsoft Silverlight platform.

In Windows operating system, a WMV coded video media file can be easily created with Windows Movie Maker, preinstalled in Windows Vista and available for free download via Windows Live Suite for Windows 7. It’s also possible to encode a video in WMV format with Windows Media Encoder or many other video editing application software that supports WMV.

It’s possible to upload a Windows Media Video WMV video file to video sharing or video hosting sites such as Youtube, Metacafe, DailyMotion, Facebook, MySpace and more. However, some webmasters or bloggers may want to host the video directly from own web server and web pages on self-hosted website, without using embed code from video sharing service which may restrict the size, resolution, length and other criteria of the streaming video.

To embed a WMV video inline on a web page (HTML, blog, PHP, ASP or other scripting language supported), and allow visitor to stream playbak and watch video content inline on site, use the following guide to build the embed code for WMV video that is displayed inline on the website and can be viewed directly from the website without leaving the web page, with automatic playback support. Embedding a WMV on web page also disable it from been served as target to be direct downloaded, nor invoke a media player to play the file after downloading.

WMV (Windows Media Video) Inline Embed and Stream Code

<object id="MediaPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="480" height="360" 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://www.domainname.tld/filaname.wmv">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<param name="AnimationatStart" value="1">
<param name="TransparentatStart" value="1">
<param name="Loop" value="0">

<embed type="application/x-mplayer2" src="http://www.domainname.tld/filaname.wmv" name="MediaPlayer" autostart="1" showstatusbar="1" showdisplay="1" showcontrols="1" loop="0" videoborder3d="0" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="480" height="360"></embed>
</object>

Each embedded WMV player on web page is defined by <object> declaration to clarify which version of Windows Media Player to call, which identified by CLSID reference and CodeBase definition. Example above uses Windows Media Player embedded player version 6.4.

“FileName” parameter is required to specify the location of the movie file.

Other parameters are optional parameters that defines how the embedded WMP player should behaves or displays, such as control whether the movie should start playing automatically as soon as it’s buffered (AutoStart), whether to display information such as file name (ShowDisplay), buffering time (BufferingTime) and more. All explanation on the embedded Windows Media Player supported properties can be read here.

Tip: If the embedded player has Control Bar (ShowControls is True), the player height has to be at least 46 pixels bigger than movie resolution so that the playback doesn’t get squeezed. Similarly, status bar (ShowStatusBar is True), which shows buffering progress and playback status of the clip requires 26 pixels of height. For example, a video with 360 of height needs to have a height reference of 406 or 386 pixels to display accurately.

Tip: If you want embeeded player to auto resize itself according to movie size, remove the width and height definition from the embed code.

The embed implementation is required which also specifies a link to the WMV video file, and application embedding. All HTML tags have to be closed properly. Below is an exampled of embedded WMV video player.