array(
'match'=>'`watch\?v=([-_a-z0-9]+)`i',
'uri'=>'http://www.youtube.com/v/%s&rel=0',
'width'=>425,
'height'=>344
),
'dailymotion' => array(
'match'=>'`video/([a-z0-9]+)_`i',
'uri'=>'http://www.dailymotion.com/swf/%s&related=0&canvas=medium',
'width'=>480,
'height'=>381
),
'vimeo' => array(
'match'=>'`/([0-9]+)`',
'uri'=>'http://www.vimeo.com/moogaloop.swf?clip_id=%s&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&fullscreen=1',
'width'=>400,
'height'=>302
),
'google' => array(
'match'=>'`\?docid=(-?[0-9]+)`',
'uri'=>'http://video.google.com/googleplayer.swf?docId=%s',
'width'=>425,
'height'=>364
),
'metacafe' => array(
'match'=>'`watch/([a-z0-9\/]+)_`i',
'uri'=>'http://www.metacafe.com/fplayer/%s.swf',
'width'=>400,
'height'=>345
)
);
// extract service's name and check for support
preg_match('`^http://(?:[^\.]*\.)?([^\.]*)\.[^/]*/`i', $videoUri, $match);
if(empty($match[1]) || !array_key_exists($match[1], $service)) {
return '[video (unkown provider)]';
}
$s = $service[$match[1]];
// extract videoId
preg_match($s['match'], $videoUri, $match);
if(empty($match[1])) {
return '[video (cant extract ID)]';
}
$playerUri = sprintf($s['uri'], $match[1]);
// display flash player
return
'';
}