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:

1.

Create the desired movie or sound.

2.

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

3.

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.

4.

Type > to complete the initial object tag.

5.

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.


6.

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

7.

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

8.

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.


9.

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.

10.

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

11.

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

12.

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

13.

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.


Tips

  • 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

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