HTML and CSS Reference
In-Depth Information
This first JavaScript function sets the appropriate
flashvars
attribute values, namely the video to
be played as well as the
autostart
value.
var params = { allowfullscreen:'true', allowscriptaccess:'always' };
Next, two more parameters are set,
allowfullscreen
and
allowscriptaccess
— enabling both.
var attributes = { id:'player1', name:'player1' };
In the third code line, the video player is identified with an ID and name.
swfobject.embedSWF('../mediaplayer-5.3/player.swf','myVideo','480','270',
'9.0.115','false',flashvars, params, attributes);
The final code line is jam-packed as it calls a function in the
swfobject
library,
embedSWF()
. The
arguments passed to the function are, in sequence:
➤
The path to the video player
(../mediaplayer-5.3/player.swf
)
The ID of the containing element (
➤
myVideo
)
➤
The width (
480
)
The height (
➤
270
)
➤
The version number of the least acceptable Flash Player (
9.0.115
)
Whether the Flash Express Install should be made available (
➤
false
)
➤
Passing the three variables (
flashvars
,
params
,
attributes
)
Though it may appear complex at first, in practice it's quite easy to configure because you're gener-
ally changing only one or two values. When implemented on a page, the resulting video plays just as
smoothly as the HTML tag method, as shown in Figure 25-3.
FiGure 25-3