Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

408 LESSON 14: Integrating Multimedia: Video and Sound


The configuration variables that are available depend entirely on the Flash movie
that you’re using. You can also configure the movie through the dynamic publishing
approach, but it requires a bit more knowledge of JavaScript. For more information,
check out the online documentation for SWFObject after the JavaScript lessons.
In the next section, I talk about some specific Flash video players, both of which can be
embedded in a page using SWFObject.

Flash Video Players


You’ve learned how to embed video in pages with the <video> tag and how to embed
Flash content in pages. Next I introduce some Flash players that can play the same videos
you created for use with the <video> tag. These players are useful because they enable
anyone who has Flash to view your videos. A number of such video players are available.
In this section, I discuss two of them: JW Player and Flowplayer.

JW Player


JW Player is a popular Flash video (and audio) player. It is licensed under a Creative
Commons noncommercial license, so it’s free to use so long as it’s not for a commer-
cial purpose. It also requires you to attribute the work to its creator when you use it; in
other words, you have to link back to the JW Player website when you embed the player.
There’s also a commercial version available that you can use for any purpose without
the link to the JW Player website. If your website includes advertising, you must use the
commercial version of JW Player.
To download JW Player, go to https://github.com/jwplayer/jwplayer.
After you’ve downloaded the player, you’ll need your video file as well as the Flash
player itself: player.swf. JW Player includes a sample file that uses the <object>
and <embed> tags, but you should use a standards-complaint approach. You can use
SWFObject to embed JW Player, as shown in Figure 14.12 using the following code :
<script src="swfobject.js"></script>
<script>
swfobject.registerObject("myId", "9", "expressInstall.swf");
</script>
<div>
<object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
width="400" height="315">
<param name="movie" value="player.swf" />
<param name="flashvars" value="file=video.mp4" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="player.swf"
width="400" height="315">
Free download pdf