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>


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
on October 17th, 2007 at 11:21 am
agreed! yours is the only code I've found that works.
Thanks!
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
on December 17th, 2007 at 2:21 pm
Excellent Code – works with no problems. Thanks for this.
on March 8th, 2008 at 5:02 pm
wow! This really works! I was getting very frustrated until I found this code! Great!
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.
on June 25th, 2008 at 4:43 pm
yes, it would be nice not to have the black startup screen, anybody?
on July 10th, 2008 at 10:07 am
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.
on July 16th, 2008 at 4:53 am
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
on September 3rd, 2008 at 4:12 pm
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
on September 25th, 2008 at 3:02 pm
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.
Michelle
on November 5th, 2008 at 6:10 pm
Exactly what I needed… thank you very much!
on November 19th, 2008 at 3:43 pm
try this to avoid Active X content, that pops up
.
on December 3rd, 2008 at 4:05 pm
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
on February 1st, 2009 at 6:23 pm
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!
-Matt
on March 3rd, 2009 at 12:42 pm
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:
wmode="transparent"
on March 3rd, 2009 at 12:46 pm
I think the object param was striped from my reply
param name="wmode" value="transparent"
on March 6th, 2009 at 3:18 pm
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.
on March 31st, 2009 at 2:05 pm
Thanks. I placed this code on tripractix.com/testimonial, but it will not work with Safari or Firefox. Any thoughts?
on April 8th, 2009 at 2:38 pm
Hi ..it's works fine in my internet explorer..but doesn't work in firefox..anyidea..thanks for the work…
on April 25th, 2009 at 12:31 am
I agree. Your code works and the others don't. Not in Firefox or Safari to be sure but in IE. Thanks.
on May 1st, 2009 at 7:34 pm
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.
on May 5th, 2009 at 10:43 am
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?
on July 20th, 2009 at 1:05 pm
This code only seems to work with IE. Any thoughts?
on July 30th, 2009 at 12:20 am
[...] Good link for embedding video [...]
on December 3rd, 2009 at 4:13 pm
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.
-Melissa
on February 16th, 2010 at 4:05 pm
Great code. It works perfectly. Thanks for taking the time to put this information together. I really appreciate it.
Jen
on February 20th, 2010 at 10:27 am
thanks for help
on February 25th, 2010 at 9:07 pm
Still works!
on April 6th, 2010 at 9:46 am
But this is not working in Chrome is der is any other solutions for this
on June 6th, 2010 at 11:16 am
Justin,
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
on June 6th, 2010 at 11:20 am
Justin,
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
on October 21st, 2010 at 10:25 am
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?
on March 14th, 2011 at 4:33 am
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..
on March 14th, 2011 at 4:34 am
ya…it's working…i want store the video time limit in data base……
on May 2nd, 2011 at 11:28 am
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
src="http://thesecure-store.com/DougtheRemovalsDog.wmv">
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
on May 26th, 2011 at 2:30 pm
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.
on December 24th, 2011 at 2:53 am
how i can put up .wmv file and on which path?
on December 30th, 2011 at 5:31 am
how to change the url (path) of the wmv files if we are writing the files in a cd or dvd
on December 30th, 2011 at 5:36 am
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?