Library 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:

Actionscript:
  1. package newcommerce.keepvid
  2. {
  3.     import flash.display.MovieClip;
  4.     import flash.events.Event;
  5.     import flash.media.Video;
  6.    
  7.     /**
  8.      * ...
  9.      * @author Martin Legris
  10.      */
  11.    
  12.     public class KeepVidTest extends MovieClip
  13.     {
  14.         protected var _client:KeepVidClient;
  15.        
  16.         public function KeepVidTest()
  17.         {
  18.             _client = KeepVidClient.getInstance();
  19.             _client.addEventListener(KeepVidEvent.FLV_URL_RECEIVED, doFlvUrlReceived);
  20.            
  21.             var url:String = "http://www.vimeo.com/1248957"; //"http://www.youtube.com/watch?v=9XbR3qG_1WI";
  22.             _client.getFLVUrl(url);
  23.         }
  24.        
  25.         protected function doFlvUrlReceived(evt:KeepVidEvent):void
  26.         {
  27.             trace("hd:" + evt.hdUrl);
  28.             trace("ld:" + evt.ldUrl);
  29.         }
  30.     }
  31. }

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.

Full Source

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):

  1. TubeGripClient - Play Any Movie on YouTube in AS3 with your own player!


One Response to “Library to get direct access to YouTube & Vimeo FLV’s in AS3”

  1. john says:

    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!

Leave a Reply