Easily Embed a Windows Media Player in a Web Page

I keep forgetting the code that's required to embed a Windows Media Player movie in a web page, so I decided to add it to my Snippets collection for easy reference.
<object type="video/x-ms-wmv"
	  data="YourMovie.wmv" width="320" height="260">
  <param name="src" value="YourMovie.wmv" />
  <param name="autostart" value="true" />
  <param name="controller" value="true" />

This code is supposed to work cross browser.

(Taken from: Bye Bye Embed at alistapart.com)

You can check out a live demo here where you can see a video of a "Berenbos" bear with compulsive behavior. This video is not looped; this is what the poor bear does most of the day.

Where to Next?

Wonder where to go next? You can read existing comments below or you can post a comment yourself on this article .

Consider making a donation
Please consider making a donation using PayPal. Your donation helps me to pay the bills so I can keep running Imar.Spaanjaars.Com, providing fresh content as often as possible.

Feedback by Other Visitors of Imar.Spaanjaars.Com

On Saturday, September 30, 2006 7:19:15 AM gt said:
I have to say that your web site is very well! Maybe someone who is studying the asp.net2 and C# like me can find a better way to reach their goal under your help.  From now on , i will come here at every turn. And i want to make a friend with you,of cource if you like.
On Saturday, September 30, 2006 8:08:50 PM Imar Spaanjaars said:
Hi gt,

You're welcome. The site is on-line 24/7 so feel free to check back often... ;-)


On Friday, March 30, 2007 12:39:25 AM sweth said:
i want to embed media player classic which plays .rm files into my webpage .any help?
On Sunday, April 15, 2007 9:52:59 PM Bryan Green said:
Question: how would I pass a filename to an embedded Media Player?

For example: I have a list of songs that are stored on my webserver that I want to play in an embedded player as a user clicks on the link for the song they want to preview...
On Monday, April 16, 2007 6:38:42 PM Imar Spaanjaars said:
Hi Bryan,

You can use a server side language to write out the object tag with the file name in it.

Alternatively, I think you can script against the object and change the URL client side. I don't have any read-made code for that, but I am sure Google does....

On Tuesday, March 11, 2008 2:07:47 PM sanjeevaney said:

This is the smallest code I've found to embed a wmv file. Does it work in all browsers? Is there a similar small code available for embedding quicktime, real and flash?
On Tuesday, March 11, 2008 7:21:35 PM Imar Spaanjaars said:
Hi sanjeevaney,

Yes, it works cross browser in modern browsers if that is what you mean with "all browsers"; it certainly won't work in Netscape 2.12.

With regards to your other question: why don't you try it out and let us know? ;-)

On Sunday, December 28, 2008 1:01:43 AM Emiel Stöpler said:
With regards to using just the "object" tag for embedding Flash: yes, that'll work in all browsers:

[object type="application/x-shockwave-flash" data="movie.swf"]
[param name="movie" value="movie.swf" /]

However, IE won't actually stream the movie, as is explained in this article by HTML (my bible for XHTML):


The article also lists a link to a valid, albeit not very pretty solution to work around this.
On Monday, January 5, 2009 9:45:05 AM harsh shah said:
this embeded code is very useful for me
but i do not know how to play audio/video file on hyperlink click .
if possible then please help me.
On Monday, January 5, 2009 9:49:53 AM Imar Spaanjaars said:
Hi harsh,

You can simply link to the video file using an a element. Alternatively, you can link to a page or popup that contains this object element.


On Thursday, January 29, 2009 3:47:05 PM imran chughtai said:
Dear All

I want to embeded media player with list and play real video file how it is possible if yes please send me codes
On Thursday, January 29, 2009 9:54:50 PM Imar Spaanjaars said:
Hi imran,

Yes and? Have you searched Google for this? Have you tried my code? I am not going to do the research this requires for you so I guess you'll need to look elsewhere.


On Wednesday, February 17, 2010 11:16:55 AM soumya said:
I have a wmp control. how can I upload their videos into my website
On Wednesday, February 17, 2010 3:16:24 PM Imar Spaanjaars said:
Hi soumya,

You can use <input type="file"> to let users select a file. You then handle and save the file using some server side technology. How this works depends on the technology you are using.


On Tuesday, July 13, 2010 12:10:04 PM noora said:
thank you for this code, but what if i want to view video of type flv?
On Sunday, July 18, 2010 4:27:00 PM Imar Spaanjaars said:
Hi noora,

You may want to take a look at the JW Player: http://www.longtailvideo.com/players/jw-flv-player/


On Saturday, July 24, 2010 6:23:18 PM hammad said:
well i have made a website through webs.com and i have made a list of songs in my download folder of my website and when i click a link it starts to download rather then played directly onto my website so kindly help me in embedding window media player in my website and as i click a song link it should play right there on my website i will be waiting for your reply
On Sunday, July 25, 2010 7:51:09 AM Imar Spaanjaars said:
Hi hammad,

Don't wait for my replies, as you may wait for ever.... ;-)

Try searching Google for Mediaplayer playlist.


On Wednesday, June 1, 2011 11:05:51 PM Andy said:
Thanks for sharing. It looks pretty easy. My question would be does it slow down your website load up time.
On Thursday, June 2, 2011 3:22:39 AM Imar Spaanjaars said:
Why would it? It's just plain HTML and the player won't start playing until the HTML is downloaded...

On Wednesday, January 11, 2012 9:02:01 AM evon said:
Can this work in Google Chome?
Because i tried to browse it in google chrome but the object dosent seem to appear
On Wednesday, January 11, 2012 6:42:18 PM Imar Spaanjaars said:
Hi there,

I think it works if you have the Media Player plugin installed in Chrome. Not sure though...


On Tuesday, March 20, 2012 10:51:46 PM Susie said:
I want to promote a movie on my website. I have the embed code from the movie's official site. Is there a way to have the movie trailer player in my player instead of the movie company's player?
On Tuesday, March 20, 2012 11:15:05 PM Imar Spaanjaars said:
Hi Susie,

Not if you don't have access to the raw / original movie.


On Wednesday, March 21, 2012 2:19:23 AM Susie said:
Hi Imar,

Thanks for the response. I actually do have access to the raw/original movie trailer that I want to promote on my site.

How do I have the movie trailer play in my website's player using the raw/original movie?
On Saturday, December 6, 2014 5:35:27 PM Wolfy said:
I'm using this code to play 30-45 minute video clips.  This takes 3-5 minutes for a full download.  How do I get it to stram?
On Sunday, December 7, 2014 12:25:45 PM Imar Spaanjaars said:
Hi Wolfy,

This article is over 8 years old, and quite a bit has changed since then. You may want to switch to the HTML 5 video element, described here:




Talk Back! Comment on Imar.Spaanjaars.Com

I am interested in what you have to say about this article. Feel free to post any comments, remarks or questions you may have about this article. The Talk Back feature is not meant for technical questions that are not directly related to this article. So, a post like "Hey, can you tell me how I can upload files to a MySQL database in PHP?" is likely to be removed. Also spam and unrealistic job offers will be deleted immediately.

When you post a comment, you have to provide your name and the comment. Your e-mail address is optional and you only need to provide it if you want me to contact you. It will not be displayed along with your comment. I got sick and tired of the comment spam I was receiving, so I have protected this page with a simple calculation exercise. This means that if you want to leave a comment, you'll need to complete the calculation before you hit the Post Comment button.

If you want to object to a comment made by another visitor, be sure to contact me and I'll look into it ASAP. Don't forget to mention the page link, or the QuickDocId of the document.

For more information about the Talk Back feature, check out this news item.