How to embed Windows media player in web page?

I want to embed an avi file to play in WM automatically on a web page. How do I do this? Thanks

There is a way, but it’s a little tricky.

Here’s a sample from a website:


<object id="MediaPlayer2" width="400" height="50" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
    A lot of param tags here...
    <embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="**YOUR FILE HERE**" name="MediaPlayer2" showpositioncontrols="0" showstatusbar="1" volume="-1" width="400" height="46">
    </embed>
</object>

Try the Windows Media Player SDK (here) in MSDN for more info.

I found this but I don’t want those buttons and I want it to start playing automatically. I’ve never done anything like this before and am not too familiar with the coding. If someone could provide me all the exact code needed (minus the exact url of my video) to make this work it would be greatly appreciated. Thanks.

First ask yourself a few questions. Why do you want the file to play automatically? Downloading and playing large files like this can be a significant strain on slower connections, – so to be courteous, it seems you should let the page load, describe the file and give the user the option of downloading the file. And why do you want the file to play in Windows Media Player? Some people might have other preferences as to media players, and some might not even have Windows Media Player, or, for that matter, Windows, – so, again, to be courteous, it seems you should give the user the option of choosing his preference of players.

(And incidentally, the page you link to shows how to hide the controls. So far as having it autostart, I don’t know if there’s a multi-browser compatible way to do this – a few sites said Netscape always gave the user the option of starting it.)

I agree that it may not be a great idea to have it download the video automatically for the site but if it is small enough then maybe. However, if you wish to do this then I suggest you go here and follow the instructions about “AUTOSTART.” Hope this helps!

I’d find out what the page is before going off questioning that…

If its a splash page at the beginning, you could always give a warning saying the video size and put a link to skip over it…

If its on a large page with a lot of content, I agree with Mtrawls and maybe give the viewers the option to start the movie as you please, or a link to even download it to their machine (depending on what its for)