Embedding Windows Media, Part 1

Microsoft's suggested way of embedding Windows format movies and sounds on your Web page still requires the use of the old nonstandard embed tagif you want it to work in anything besides Internet Explorer for Windows. I'll show you how to embed it in a standards-compliant way on page 304.

To embed Windows Media Player files:


Create the desired movie or sound.


In your (X)HTML document, type <object class .


Next type width="w" height="h", where w and h are the size in pixels of the media player that you'd like to embed.


Type > to complete the initial object tag.


To tell the player where the media file is, type <param name="url" value="movie.wmv">, where movie.wmv is the name and extension of the movie file.

Figure 18.42. Microsoft recommends using the object element in a non-standard way and the non-standard embed element.


If desired, you can type <param name="autostart" value="false"> in order to keep the file from playing automatically. The default is TRue.


If desired, you can type <param name="showcontrols" value="false"> to hide the play, rewind and other control buttons. The default value is true.


For browsers besides Internet Explorer, type <embed type="application/xmplayer2" to tell them what to expect.

Figure 18.43. The Windows Media Player is embedded in the page.


Next type src="/books/2/62/1/html/2/http://www.movie.wmv", where movie.wmv is the location, name, and extension of the movie file.


Type width="w" height="h">, where w and h are the dimensions in pixels of your movie file.


If you want the movie to start playing automatically, type autostart="true".


If you want to hide the control buttons, type showcontrols="false".


Type /> to complete the embed element.

Figure 18.44. If your visitor does not already have Windows Media Player on their computer, they will be invited to install it.

Figure 18.45. Once the plugin is installed, the movie is displayed properly.


  • The default format for movies for the Windows Media Player is wmv.

  • The classid is hideous but not case sensitive.

  • The embed tag is non-standard but very well supported by most major browsers. It's the only way I've found to embed a Windows Media Player in the Microsoft-sanctioned way (e.g., with the classid attribute) into non-Explorer browsers. (But I still hate it.) I'll show you another way to embed Windows Media Player files on page 304.

  • You can personalize the Windows Media Player with custom skins and scripting. See Microsoft's site for details.

  • Another alternative to using the embed element would be to use a second object element to set up a QuickTime version of the movie in QuickTime format for standards-loving browsers.

  • QuickTime can't view WMV files on its own, though it can view them with Flip4Mac (http://www.flip4mac.com).

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net