Partager via


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

  • Anonymous
    September 30, 2004
    The comment has been removed
  • Anonymous
    September 30, 2004
    Hm, isn't it the other way around: new ActiveXObject() only works with WMP and no other objects in Moz/Fx?
  • Anonymous
    October 03, 2004
    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!
  • Anonymous
    October 26, 2004
    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
  • Anonymous
    October 29, 2004
    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" />
  • Anonymous
    July 20, 2005
    can u put more than one videos on your page?
    if so how?
  • Anonymous
    July 31, 2005
    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?
  • Anonymous
    September 15, 2005
    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.
  • Anonymous
    February 27, 2006
    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
  • Anonymous
    March 12, 2006
    Very interesting and beautiful site. It is a lot of helpful information. Thanks!
  • Anonymous
    March 15, 2006
    Like Kipling, your page is a treasure. Many thanks

    <a href = "http://www.photovideo-store.info">www.photovideo-store.info</a>
  • Anonymous
    March 16, 2006
    The comment has been removed
  • Anonymous
    March 18, 2006
    Very interesting and beautiful site. It is a lot of helpful information. Thanks!
  • Anonymous
    March 20, 2006
    This was really helpful.I was actually stranded on how to add BillG's keynote on to my blog. Thx for the tip.
  • Anonymous
    April 03, 2006
    I want mp3 player. What will advise?
  • Anonymous
    June 02, 2006
    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 ??
  • Anonymous
    July 05, 2006
    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???
  • Anonymous
    September 21, 2006
    Great page. Really helpfull and easy to understand. Thanks