Claus on Code

A data dudes random musings about code, bugs, products, life etc.


Embed media players in your website

In the process of creating a web based media centre, I need to be able to play media in a website. It is surprisingly easy with activeX components, and much easier than using the difrent players in a window based application. If you want to use MS media player in your web site, paste in the following code:

<OBJECT\r\nID=”mediaPlayer”
CLASSID=”CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95″
CODEBASE=http://activex.microsoft.com/activex/controls/

mplayer/en/nsmp2inf.cab#Version=5,1,52,701
STANDBY=”Loading Microsoft Windows Media Player components…”
TYPE=”application/x-oleobject”>
<PARAM NAME=”fileName” VALUE=”example.avi”>
<PARAM NAME=”animationatStart” VALUE=”true”>
<PARAM NAME=”transparentatStart” VALUE=”true”>
<PARAM NAME=”autoStart” VALUE=”true”>
<PARAM NAME=”showControls” VALUE=”true”>\r\nOBJECT>

Likewise for Quicktime. Paste in the following:

<OBJECT CLASSID=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B”
WIDTH=”160″
HEIGHT=”144″
CODEBASE=”http://www.apple.com/qtactivex/qtplugin.cab”>
<
PARAM name=”SRC” VALUE=”sample.mov”>
<
PARAM name=”AUTOPLAY” VALUE=”true”>
<
PARAM name=”CONTROLLER” VALUE=”false”>
<
EMBED SRC=”sample.mov” WIDTH=”160″ HEIGHT=”144″ AUTOPLAY=”true”
CONTROLLER=”false”
PLUGINSPAGE=”http://www.apple.com/quicktime/download/”>
<
EMBED><OBJECT>

The parameters should be self explaining.

An example of a webpage using the code, can be seen here: http://mptest.clauskc.net/



Leave a Reply

Your email address will not be published. Required fields are marked *