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>



  1. 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.


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

  3. 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. Excellent Code – works with no problems. Thanks for this.

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

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

  7. yes, it would be nice not to have the black startup screen, anybody?

  8. When I saw the date of original post, I was afraid that the information would be outdated. To my surprise, it works great!!! Thanks, and I'll keep watching for updates as we evolve to newer coding routines.

  9. thanks a lot!! I was experimenting with others embed/object that I found in the net but this is the best example, and it works with firefox/opera

  10. I have a JavaScript down menu on my page which now appears behind my video, any suggestions on how to move it to the front

  11. Did anyone ever figure out how to get a screen shot instead of the black screen? I think it worked perfected except for this one little thing.

    Thank you foy rour help.

  12. Exactly what I needed… thank you very much!

  13. try this to avoid Active X content, that pops up :).

  14. Nice post and appreciate the info. I inserted it into my blog and got only a black screen to come up. When I click on play, nothing happens. But, when I put in the full URL to the VID and click, it works fine. Any idea of what I'm doing wrong? The page I'm referencing is http://www.forshizelmynizel.com/a-kilt-a-sausage-and-some-buns.html

    THANKS AGAIN! Really do appreciate people like you helping rook's like us 🙂

  15. Thanks! It works well with Firefox but for some reason Internet Explorer doesn't play the file. It shows the player but doesn't play. The 'play' button doesn't even offer the option to start.

    Anyone with any ideas? Thanks!


  16. to allow drop menus to appear in front of the video, you need to change the window mode to transparent.

    In the object tag, add:

    In the embed tad, add:

  17. I think the object param was striped from my reply

    param name="wmode" value="transparent"

  18. Thank you for your help. I was trying to use Dreamweaver to embed the audio file but could not get it to find the plug-in. Your code works perfectly.

  19. Thanks. I placed this code on tripractix.com/testimonial, but it will not work with Safari or Firefox. Any thoughts?

  20. Hi ..it's works fine in my internet explorer..but doesn't work in firefox..anyidea..thanks for the work…

  21. I agree. Your code works and the others don't. Not in Firefox or Safari to be sure but in IE. Thanks.

  22. Hi all,

    For what it's worth I, like Matt above, got this code to work in Firefox but not IE. I used the similar but slightly different code at this site and it worked on both. This may just be due to some other error on my part though, so YMMV.

  23. I've had this code on my website for a couple years working fine. For the last couple months it stopped delivering the video to the users browsers. Has microsoft changed something?

  24. This code only seems to work with IE. Any thoughts?

  25. Starting a Website | Apple Town Prince

    […] Good link for embedding video […]

  26. This code isn't working for me at all on IE or firefox. :-/ Any suggestions? Is any part of it broken? I've been inserting the link to my video and all that…nothing. Doesn't play in firefox even when I click the button, and won't give the option to play in IE. Please help, TY.

  27. Great code. It works perfectly. Thanks for taking the time to put this information together. I really appreciate it.


  28. thanks for help

  29. Rinosh.K.Sasidharan

    But this is not working in Chrome is der is any other solutions for this

  30. Online Consulting

    Thank you very much for posting this script. I just used it on my site to embed qa homemade video and it worked great. Sometimes you just don't want to go through the trouble to submit to YouTube just so you can display your own movie. And I really didn't want to have to buy special software. Thanks again for something that really does work.

    Allen Harp

  31. Online Consulting

    I forgot to mention based on the comments above, this script works just fine for me on my wordpress blog and I am viewing with IE 8.0.6

    Allen Harp

  32. Dear Sir, I've done a perl program wich generate a webpage everytime someone upoload a file. for pictures no problems but for multimedia I see no easy way to use only one objet in order to reproduce all possible contents. therefore I have generate a code for mp3 wav aiff with mediaplayer, anoter for mp4 with Quicktime, flashplayer for swf ecc.. Could someone suggest me an easier way?

  33. ya..it is working….but i want to get time from window media player….how can i get……….i want to store play time in data base..

  34. ya…it's working…i want store the video time limit in data base……

  35. Bedfordshire Storage

    Yep! All working nicely thank you. The key (for anyone as untechnical as me who is reading this) is to ensure you replace the text – value="http://yourdomain/yourmovie.wmv"> AND
    src="http://media.pmcmovies.com/SixtiesLove.wmv" with your own domain name.
    e.g. "http://thesecure-store.com/DougtheRemovalsDog.wmv"> And
    Oh – and if you do not want the movie to play immediately, change the autostart value from "True" to "False" – the user then has to click to play it.
    and finally, see 'David's comments (x 2) above

  36. I would suggest to use a cross-browser JavaScript libraries such as SWFObject or Voynex Object Embedding ( http://voynex.com/products/object-embedding ) to easily embed multimedia to your HTML documents. With the help of those libraries you can embed audio, video and other types of object in a line of code.

  37. how i can put up .wmv file and on which path?

  38. how to change the url (path) of the wmv files if we are writing the files in a cd or dvd

  39. Katrina kaif(hot and nude)

    Nice post and appreciate the info. I inserted it into my blog and got only a black screen to come up. When I click on play, nothing happens. But, when I put in the full URL to the VID and click, it works fine. Any idea of what I'm doing wrong?

  40. how can i insert fill viewed video with out action buttons on bottom?
    maybe it can make my website looks more professional,i guess…..

Leave a Reply

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

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image