SWFObject and Dreamweaver FLV Player

So Dreamweaver has some nice little built in FLV Players and functionality to insert them on a page for you. Only problem is they make use of the old ‘object’ and ‘embed’ tags. SWFObject is a much more graceful, standards-compliant method for adding Flash to your site, so why not combine the two?

I wanted to use the progressive player that Dreamweaver provides, so I generated the code, pulled out the flashvars and parameters and inserted them into the SWFObject code like so:

(Line wraps marked »)

<script type="text/javascript">
    var flashvars = {
        skinName: "video/Clear_Skin_3",
        streamName: "MyVideoTitle",
	autoPlay: true,
	autoRewind: false
    };
    var params = {
        movie: "video/FLVPlayer_Progressive.swf",
	salign: "tl",
	quality: "high",
	scale: "noscale"
    };
    var attributes = {};

    swfobject.embedSWF("video/FLVPlayer_Progressive.swf", "FLVPlayer", »
    "800", "600", "9.0.0","video/expressInstall.swf", flashvars, params, »
    attributes);
</script>

The important thing here being, that the path to the video file is relative to the player SWF (in this case ‘FLVPlayer_Progressive.swf) NOT the page calling it – Nice!