Adding Videos to a Web Page


Today, someone asked me about how to add a video clip to a Web and show the controls.  This is relatively easy, so I thought I would share with all of you how to do this.  You can do this by using the Windows Media Player. To do this, switch to Code (or HTML) view and paste the following HTML code:

<object id="WMPlayer1" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="250" width="250">
<param name="uiMode" value="full" />
<param name="autoStart" value="true" />
<param name="URL" value="SampleVideo.WMV" />
Your browser does not support ActiveX controls or the Windows Media Player.
</object>

To make this work for your video file, change the value of the value attribute (see red text above) to the path and filename of your video file. If you want to change the size of the view, change the value of the height and width attributes (see blue text above) to the height and width that you want.

Once you add the HTML, you can change the filename and size using the properties dialog box also. Just switch back to Design view and double click on the control.

This code displays video files in Internet Explorer and Netscape Navigator. I was unable to get this to display properly with Mozilla.  (I'm not sure if that means that Mozilla doesn't support Windows Media Player or ActiveX controls, or if there is a property that I need to set.  Anyway, I wasn't able to find an ActiveX property in the Preferences dialog, so I'm assuming that Mozilla doesn't support any ActiveX controls. If anyone has any information about this, please let me know.) I didn't test it in Opera (which I don't have installed on my computer, but I am rectifying since so many have offered comments about Opera), so I can't tell you whether it works in Opera or not. In addition, the visitor must have Active X controls enabled in their browser.

Note   This code works well as long as the visitor has Windows Media Player installed on their local computer.  If they don't, then they may be asked to install it. ActiveX controls are installed locally on the visitors machine, so they can have security risks associated with them.  Most browsers allow users to turn off installing, displaying, and running them, and Internet Explorer allows users to run them if they are signed, to prompt before installing them, and to disable unsigned ActiveX controls.

Comments (18)

  1. foobar says:

    ActiveX does work in Mozilla/Firefox. The way it works is that the specific classID must be enabled. However, the dorks that run the project have decided not to add an entry for Windows Media Player, for whatever reason.

    There is a registry entry to fix this.

  2. b.gr says:

    Hm, isn’t it the other way around: new ActiveXObject() only works with WMP and no other objects in Moz/Fx?

  3. Dave Burke says:

    This was a great tip! I’ll have to test it with Moz/Fx (which I’ve never used) to see if I can use it in production. Thanks!

  4. jglo says:

    ok, done the above, but the video starts on its own. I want people to have to press play if they eant to see it

  5. Lisa Wollin says:

    You can make it so that Windows Media Player doesn’t start automatically by setting the autoStart parameter to "false", as in the following code, instead of "true", as shown in the above code:

    <param name="autoStart" value="false" />

  6. rena says:

    can u put more than one videos on your page?

    if so how?

  7. Brent says:

    when i post the code it will remove the <object from the code automaticly resulting in the video not being able to play….how do i get around this?

  8. Rod says:

    I tried the above code and it would not play so I inserted a Plug-In (Windows Medis Player) which does work. Then on the CODE/HTML page I inserted autoStart="false" into the attributes so the video does not start on it’s own. Works great.

  9. alex says:

    Thankyou very much for the help but is there a way i can get videos off the internet already on another website to put on mine. Thnx

    alexleng@supanet.com

  10. Very interesting and beautiful site. It is a lot of helpful information. Thanks!

  11. Rob says:

    Fuck my little tranny.. or look how others do it on <a href=&#039;http://www.fuck-tranny.info'>http://www.fuck-tranny.info</a&gt;. Every day update. Uneasiness action!

  12. Martin says:

    Very interesting and beautiful site. It is a lot of helpful information. Thanks!

  13. Harsh says:

    This was really helpful.I was actually stranded on how to add BillG’s keynote on to my blog. Thx for the tip.

  14. Anton says:

    I want mp3 player. What will advise?

  15. Robert says:

    is there any way i could stream the media as the video files i have are large and users may become bored waiting for them to download ??

  16. NCprofile says:

    Well I have been unable to get my embedded mp3 file to work as it should in firefox – works in IE and netscape.

    I don’t want it to start when the page loads. Again, i want that action to be taken by the user. I have <param name="AutoStart" value="False" /> which works in IE and netscape but firefix ignores it completely and plays the file as soon as the page loads – yuck.

    I can’t post go live until I get this fixed. Any ideas???

  17. lee says:

    Great page. Really helpfull and easy to understand. Thanks

Skip to main content