Quote from: BobRay at Oct 17, 2007, 11:30 AM
I think the embedded video snippet might be *really* popular around here. 
Itt’s pretty simple. It uses
swfobject to load the Flash files with valid markup ... I noticed recently someone has done a snippet for swfobject’s successor, swffix (?), and it could easily be updated to do that.
VidEmbed takes two arguments:
site, which is one of ’youtube’, ’google’ (video), whatever, and defaults to youtube; and
v, which is the video id at the site.
<?php
if (!$v) $site = 'bust';
if (!$site) $site = 'youtube';
// fixed params
$height = 350;
$width = 425;
// defaults
$player = '';
$vid = '';
$flashvars = array();
switch ($site) {
case 'google':
$player = 'http://video.google.com/googleplayer.swf?docId=' . $v;
$vid = 'VideoPlayback';
break;
case 'ifilm':
$player = 'http://www.ifilm.com/efp';
$flashvars['flvbaseclip'] = $v;
break;
case 'revver':
$player = 'http://flash.revver.com/player/1.0/player.js?mediaId:' . $v . ';affiliateId:0;height:' . $height . ';width:' . $width . ';';
break;
case 'bust':
break;
default:
$player = 'http://www.youtube.com/v/' . $v;
}
if (!$player) {
$result = '<div id="' . $v . '" class="vidembed">Missing movie ...</div>';
} else {
$result = '<div id="' . $v . '" class="vidembed">Loading movie ...</div>
<script type="text/javascript">
var so = new SWFObject("' . $player . '", "' . $vid . '", "' . $width . '", "' . $height . '", "6", "#fff");
so.addParam("wmode", "transparent");';
foreach ($flashvars as $key => $value) {
$result .= 'so.addVariable("' . $key . '", "' . $value . '");';
}
$result .= 'so.write("' . $v . '");
</script>';
}
return $result;
?>
$flashvars doesn’t really need to be an array, but I want the snippet to work with other sites when we need it.
Cheers
Matt