Wickham's HTML & CSS tutorial

Sitemap | back

Video example using Windows Media Player

The video requires ActiveX in IE. People without Windows Media Player will see a popup asking whether they want to download it. Wait for the file to download. Click the left button of the controller to start the video (you may have to click twice using Opera). IE6 on my old computer doesn't play the video with the object tag code so it uses the embed tag. Firefox also uses the embed tag. Firefox, Opera and Safari use QuickTime on my computer because I have QuickTime installed but people without QuickTime should use WMP. The code does not validate because of the deprecated embed tag, but it is still widely used to play in Firefox and some other browsers.

The code for the above video in mpg format is:-

<div class="noborder" style="text-align: center">
<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="320"
type="application/x-oleobject">
<param name="url" value="images/tutorial.mpg">
<param name="controller" value="true">
<param name="autostart" value="false">
<embed src="images/tutorial.mpg" controller="true" autostart="false" loop="false" width="320" height="275">
</embed>
</object>
</div>

Note that there is an embed tag nested inside the object tag. If the preferred method of showing the video fails, the browser will try the second. In the example above, Firefox works with the embed tag but not the object tag while IE works with the object tag. Allow enough height for the controller.

In most cases IE requires ActiveX enabled to view a video but Firefox, Safari and Google Chrome do not need javascript enabled with my example but Opera does.

The example uses Windows Media Player and won't show a video without it but viewers without WMP will receive a prompt to download and install it.

Some notes on parameters are shown on htmlhelp.com site which seem to be related to QuickTime but are good general knowledge. However, the comments seem to relate to IE6 as the object tag does not work in Firefox with the code shown.

A very good site is cit which will prepare the code for you for Flash, QuickTime, Real Media and Windows Media.

A sound file can be used as the alternative if the video file type is not supported by the browser.


QuickTime

For QuickTime code see QuickTime video example


HTML5 Video element

See Audio and Video in HTML5


© Wickham 2010