12.25Library to get direct access to YouTube & Vimeo FLV’s in AS3
Hi Everyone,
this is a ... hrmm ... not very legal thing to do. However I need this for a personal proof of concept so I thought I would make it available to the public. Basically I am using KeepVid's website to grab a URL to the FLV's from Vimeo and YouTube. This means you can stream those FLVs directly into your own player, no need to show the UI from Vimeo & YouTube. This client gathers both the low-def & high-def (when available) urls.
Here is the sample usage code:
-
package newcommerce.keepvid
-
{
-
import flash.display.MovieClip;
-
import flash.events.Event;
-
import flash.media.Video;
-
-
/**
-
* ...
-
* @author Martin Legris
-
*/
-
-
public class KeepVidTest extends MovieClip
-
{
-
protected var _client:KeepVidClient;
-
-
public function KeepVidTest()
-
{
-
_client = KeepVidClient.getInstance();
-
_client.addEventListener(KeepVidEvent.FLV_URL_RECEIVED, doFlvUrlReceived);
-
-
var url:String = "http://www.vimeo.com/1248957"; //"http://www.youtube.com/watch?v=9XbR3qG_1WI";
-
_client.getFLVUrl(url);
-
}
-
-
protected function doFlvUrlReceived(evt:KeepVidEvent):void
-
{
-
trace("hd:" + evt.hdUrl);
-
trace("ld:" + evt.ldUrl);
-
}
-
}
-
}
As you can see, it is trivially simple. The KeepVidClient is a Singleton, it fires a KeepVidEvent once the information has been received. This event has two properties hdUrl and ldUrl for the HighDef & LowDef urls.
[UPDATE]
Due to the fact that KeepVid.com doesn't have a proper crossdomain.xml file, it is not possible to access data from that website in Flash when hosted on another site. Meaning I can't do the RegExp magic to find out links to the FLV's after simulating the request on their site. I am using RESTProxy to avoid this problem. Source code has been updated accordingly.
I'm going to combine this with the FLVPlayer tutorial tomorrow to finally show a complete sample code using the FLVPlayer's code.
Stay tuned! I'm back!
Martin
Related posts (automatically generated):

You totaly forgot the main one here:
youtube-downloads.110mb.com
It knows all native YouTube video formats: HD, MP4, FLV, 3GP videos, multiple simultaneous downloads, preview video, auto start download, skip already downloaded files, clipboard monitoring, drag & drop from IE / Firefox, proxy support, etc. Program size only 39Kb!!
I use it a lot!
May 6th, 2009 at 4:46 am