Walker News

Windows Media Player: How To Embed WMV File In HTML Code?

Thanks to many photo/video hosting sites available for free (but restricted to certain rules), e.g. Flickr and YouTube, everyone has an easier way to share their happiness captured in digital media files over the Net.

Some buddies, however, would like to share them entirely on their personal weblogs (thank to WordPress and Web 2.0 that have made it possible).

OK, embedding pictures in HTML and show the photos inline on a webpage is easy as usual. But, it needs more typing to embed video in HTML and stream the video content inline on a webpage.

Embedded image/video VS Inline image/video

In brief, “embedded image/video” present an URL or HTML link to the media file that might invoke a download process for the target file, a new browser window to display the media file, or invoke a third party program (non-browser application) to open the media file.

Then, “inline image/video” means web browser understand how to open and display the media file inside the same browser window, in line of the text surrounding it.

How to embed Windows Media Video/WMV file in HTML code and stream the video content inline on a webpage?

Windows Media Video/WMV file sample:

Embedded WMV file:

The code:
<a href="http://walkernewsdownload.googlepages.com/HP-iPaq-614.wmv">HP iPAQ Business Navigator</a>

The result:
HP iPAQ Business Navigator

Inline WMV file:

The sample of code:
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" width="480" height="360" codebase="http://www.microsoft.com/Windows/MediaPlayer/">
<param name="Filename" value="http://walkernewsdownload.googlepages.com/HP-iPaq-614.wmv">
<param name="AutoStart" value="true">
<param name="ShowControls" value="true">
<param name="BufferingTime" value="2">
<param name="ShowStatusBar" value="true">
<param name="AutoSize" value="true">
<param name="InvokeURLs" value="false">
<embed src="http://walkernewsdownload.googlepages.com/HP-iPaq-614.wmv" type="application/x-mplayer2" autostart="1" enabled="1" showstatusbar="1" showdisplay="1" showcontrols="1" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" width="480" height="360"></embed>
</object>

The result of the sample code:



Note: You might need to download and install Windows Media Player plugin/add-on to play inline Windows Media Player files.

Custom Search

  1. Windows Live Messenger Does Not Display Music Playing In Windows Media Player – Walker News 13-11-08@02:37

    [...] Windows Live Messenger is not showing or displaying title of song played in Windows Media Player, i.e. none of the MSN contacts can see what song you’re listening [...]

  2. Angel 21-03-09@09:28

    Hi ,
    I have done “copy & Paste” this code on my sample page, but its worked only once, That was FLV player.
    Media player is not play

  3. Walker 21-03-09@23:51

    Please update the code with another WMV file as the one in the code hosted in Google Pages will not be available after exceeding the granted bandwidth :-(

  4. hiuyu 15-05-09@16:36

    very useful tutorial~!
    thank you.

  5. Heather 14-10-09@04:02

    I’ve tried several times to show my video, and it’s just not working. I’ve literally cut and paste your code, changed the file name to my wmv file, and nothing happens. What am i doing wrong? I should note, my wmv file is just a wmv file not wmv from a .com source. Does that matter?

  6. JT 27-11-09@01:14

    I”ve been able to use your example and found it very useful. I’d like to make a picture appear in the player representing the video about to be played. Is this possilbe. Maybe a background or some other technique? Thanks in advance for any help.

  7. sundar 27-11-09@23:01

    hi, evrything is perfect and happened.
    but the media file [which i have linked]having 30 minuts length is playing only 2.2 minuts and getting disconnected.
    why it is not playing full length? is there any code to be added for the media files having morethan 5mb?
    please help me.
    regards
    sundar

  8. Walker 29-11-09@23:01

    What about try to set the filename value and src of embed tag to a movie file in local hard disk, just to confirm it’s not network issue?

  9. brian 31-05-10@13:38

    how can i insert my media file that is residing in my folder. the format of my media file is in .avi format. can you please help me on how can display my video without any distortion or limitation to other web browser… because when i use embed tag.. in firefox the video needed a plug in installations? and in google chrome, my videodoes not display. properly or not working properly.

  10. Walker 31-05-10@17:21

    If the web browser needs a plugin to work, it has to be installed.

  11. Cortelious 27-07-10@01:22

    I too, have been able to use your example and found it very useful. How can I make the first frame or the picture appear in the player representing the video about to be played. Maybe a background or some other technique?

  12. Trish 28-07-10@09:31

    Hi
    Everything is working well– thanks –
    BUT in Firefox the controls for the player do not show up.
    Any thoughts?

  13. Mic 06-10-10@14:36

    Thank you so much.
    I tried quite few other versions of codes on the web without success.

    Yours worked !

    Enough said.

    Cheers,

    Michael

  14. Norm 08-12-10@21:38

    Had some probs with code working but turned out it was pointing prob at the page site. It works beautifully when I access the page. When others access the page they encounter a blank vid screen.
    Any suggestions/
    Norm

  15. Kruti 13-01-11@16:30

    Hi,

    I have used your code.
    Its awesome.

    My requirement is:
    I have a thumbnail image,and a play icon on it.
    On clcik of the play icon,the video should play.

    I have used toggling function for this.

    I have made the AutoPlay =false for the object tag.
    But this will require two play clicks….one for my play icon on the thumbnail image and one for the video player.

    I need only one click but with Autoplay=false.

    Please could you help me!!!!

  16. Rich 31-01-11@23:58

    Thanks for the great tutorial. I used it to embed a WMV directly hosted on my website which is in the same directory.

    Dreamweaver CS4 did, for some odd reason, want to throw in an additional .wmv (e.g. video.wmv.wmv) when I copy-n-pasted the code. I could then see the error after looking at the properties in the toolbar.

    Great job and wondrous thanks!

  17. Randy 21-05-11@00:55

    Thanks for this tut! It is working fine for me but there is no audio. I am pretty sure that audio is in the WMV file because I can play it locally and hear it.

    Any suggestions??

  18. Andy Emery 25-07-11@05:52

    Hello… I used your code to embed a .wmv file and play from my web page. It’s 34 minutes long, but it only play for 4 seconds and quits. I can’t see any code that would limit how long it plays. Any suggestions? Thanks for your help.

  19. Govind 29-08-11@17:23

    hi,
    Useful post. BTW how to include thumbnail image on the video?? its appearing black now and i need to get rid of the black screen replace it by some image/thumbnail.

    Any idea on how to achieve this?

  20. aris 26-01-12@00:02

    thx you bro

  21. Stink 18-03-12@02:54

    I’m making a desktop widget that plays .wmv movies. The movies start out at 500 X 385. When playing the movie on a website the movie plays fine. When playing it from the desktop widget it plays very choppy until you make it full screen. Then it plays fine.
    Is there a setting to make it play right from the desktop widget?

    Thanks

  22. rothny 19-04-12@11:03

    i want to play with alot of songs. What can i do?

  23. jatinder kumar 14-01-13@14:18

    Thanks this code works for me on all browsers…..

  24. Aamir Shahzad 19-03-13@18:49

    solution you provided not working in Firefox…One have switch tab/re-size window to activate player…its not compatible with Firefox, however it work fine in chrome and internet explorer as most do.

  25. Nate 01-07-13@09:09

    code worked perfectly!!!

2014  •  Privacy Policy