From: Alan J. Pippin Date: Fri, 18 Apr 2008 02:37:48 +0000 (-0600) Subject: Added support for embedding videos from new video site: vimeo.com X-Git-Tag: 1_1_1~6 X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/images/checkmark.gif?a=commitdiff_plain;h=8a4f854fa696366b1708d46faa24995e6895004f;p=embedvideo%2F.git Added support for embedding videos from new video site: vimeo.com --- diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index 6bb160f..0e277a4 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -161,6 +161,9 @@ class ItemAddEmbedVideo extends ItemAddPlugin { $myspaceUrlPattern="vids.myspace.com"; $myspaceUrlPattern2="myspacetv.com"; $myspaceThumbnailUrl="http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID="; + + /* vimeo */ + $vimeoUrlPattern="www.vimeo.com"; /* Gallery2 specific paths and variables */ $urlGenerator =& $gallery->getUrlGenerator(); @@ -781,7 +784,72 @@ class ItemAddEmbedVideo extends ItemAddPlugin { return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, "Unable to extract embedded video information from url: $url"),NULL,NULL); } - + + /* + ********************************** + * Embed a Vimeo Video + ********************************** + */ + } else if(preg_match("/$vimeoUrlPattern/",$url)) { + + /* Make sure we can extract a docID */ + if(preg_match("/$vimeoUrlPattern\/(.*)/",$url,$matches)) { + $video_id = $matches[1]; + } else { + return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__, + "Unable to extract video id from url: $url"),null,null); + } + + /* Grab the contents of the webpage used to display the video on video.google.com */ + list ($successfullyCopied, $contents, $response, $headers) = + GalleryCoreApi::fetchWebPage($url, $extraHeaders); + if (!$successfullyCopied) { + return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, + "Unable to get video information at url: $url - $response"),NULL,NULL); + } + + /* Extract the summary from the webpage contents */ + preg_match('/Stickam: http://www.stickham.com/editMediaComment.do?method=load&mId=xxxxxxxxx
Myspace1: http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=xxxxxxxx
Myspace2: http://myspacetv.com/index.cfm?fuseaction=vids.individual&videoid=xxxxxxxx
+ Vimeo: http://www.vimeo.com/xxxxxx

Supported File Types:
FlashVideo (.flv): http://aaa.bbb.ccc/video.flv