HTML and CSS Reference
In-Depth Information
FiGure 25-2
Many developers, including those with Adobe and Longtail Video, have leveraged a powerful, open
source JavaScript library for SWF playback called SWFObject. You can either download it from
its home in the Google Code library ( http://code.google.com/p/swfobject/ ) or , as JW Player
does, just reference the file with a <script> tag in the <head> of your document:
<script type=”text/javascript”
src=” http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js”></script>
Next, you'll need to create a block-level containing element — either a <div> or <p> tag — with an
id attribute defined:
<div id=”myVideo”>
</div>
Finally, you insert the JavaScript functions, wrapped up neatly in a <script> tag within the con-
taining element:
<script type=”text/javascript”>
var flashvars = { file:'../assets/Star2.flv',autostart:'true' };
var params = { allowfullscreen:'true', allowscriptaccess:'always' };
var attributes = { id:'player1', name:'player1' };
swfobject.embedSWF('../mediaplayer-5.3/player.swf','myVideo','480','270',
'9.0.115','false',
flashvars, params, attributes);
</script>
Take a look at the JavaScript broken down one line at a time.
var flashvars = { file:'../assets/Star2.flv',autostart:'true' };
Search WWH ::




Custom Search