November 29th, 2006

How to embed a .wmv file in a webpage

Ever wanted to have a .wmv file play automatically when a user visits your website? This is how you'd do it. Each embedded player instance on your Web page needs the object definition to clarify which version of the Windows Media Player will be called. This is identified by both the CLSID reference and the CODEBASE definition.

Here's the code to embed a Windows Media File into an HTML page:

<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">

<embed type="application/x-mplayer2" src="http://media.pmcmovies.com/SixtiesLove.wmv" name="MediaPlayer" width=320 height=240></embed>

</object>

6 Responses to ' How to embed a .wmv file in a webpage '

Subscribe to comments with RSS or TrackBack to ' How to embed a .wmv file in a webpage '.

  1. May said,

    on October 5th, 2007 at 10:45 am

    Thanks for the code. I've been looking for a lot of them, and yours is the only one that works. Unfortunately, my Internet Explorer keeps popping up the information bar asking me if I'm sure I want to see the active content. I followed the instructions in the help to turn it off, but it still keeps popping up! (I have XP) Too annoying to use.

    But thanks anyway. Your code works great.

    May

  2. shawn said,

    on October 17th, 2007 at 11:21 am

    agreed! yours is the only code I've found that works.
    Thanks!

  3. Angelz said,

    on October 31st, 2007 at 10:26 am

    thank you for the code!
    this is the best code that i have found on the net and which is very understandable. thanks again

  4. malcolm said,

    on December 17th, 2007 at 2:21 pm

    Excellent Code - works with no problems. Thanks for this.

  5. Bill said,

    on March 8th, 2008 at 5:02 pm

    wow! This really works! I was getting very frustrated until I found this code! Great!

  6. BZ said,

    on April 29th, 2008 at 2:55 pm

    How do you avoid the black startup screen? I'd like the player to feature a still photo from my video…to entice viewers.

Leave a reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image