YouTube Data API – new rollout

14 actionscript,as3,flash,webservices,work,youtube  |   March 12, 2008  |     1780

Hi Everyone,

YouTube released a few days ago a new version of their data API. You can now interact with the system; you are no longer limited to simply retreiving publicly available information. You can now

  • Add, Remove and Modify Favorites
  • Create, Modify and Delete Playlists
  • Add To, Remove From and Reorder Playlists
  • Upload, Delete and Update Videos
  • Rate and Comment Videos

To enable these actions, you need to login through the standard Google API Authentication procedure. I have succeeded in doing so, and using all the actions mentionned above that can be done using POST and GET. However I realized that with Flash CS3 you are not allowed to use PUT & DELETE http methods.

I have found a project called as3-active-request, which enables HTTP requests using a Socket, which would let you do anything you want. I’m unsure as to the exact security policy of using the Socket, I had a hard time with XMLSocket a while back when coding a Jabber enabled Chat Client.

Basically I’m digging into the problem, I hope to have this resolved tomorrow at some point! If anybody can help me out, i’d appreciate it!

UPDATE 2008-03-13 (hey i’m 29 today!)

So after lotsa digging, fixing, playing around; it’s pretty clear that doing PUT and DELETE HTTP commands from Flash Player is impossible w/o the HTTPService class from Flex. My personal problem is that just to use that class I end up with a 130k+ SWF. I use FlashDevelop, so I created a Default Project then added this code to the main class:

You end up with a 130k+ file, plus it doesn’t even work, saying that:

[code]Error: No class registered for interface ‘mx.resources::IResourceManager’.
at mx.core::Singleton$/getInstance()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\core\]
at mx.resources::ResourceManager$/getInstance()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\resources\]
at mx.rpc.http::HTTPService$iinit()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\http\]
at Main$iinit()[C:\work\web\New Project\classes\]

Whatever that means. I’m not a fan of Flex at all, I can do everything myself in pure AS3, BUT I can’t do DELETE and PUT HTTP Requests with URLLoader, and using a Socket, well the documentation says clearly that:

The calling SWF file and the network resource being accessed must be in exactly the same domain. For example, a SWF file at can connect only to a server daemon at

Making it useless for calls to webservices like YouTube or Flickr or others.

Basically, I’m stuck. So for now, there won’t be any support for Updating and Removing calls in the YouTube Data API.

In the meantime, you can still use the library as it is, which you can find here.



  • April 2, 2008 at 6:02 am

    Sönke Rohde » AS3/Flex and the new YouTube API

    […] The first one has a Flash CS3 tutorial and uses the JSON stuff of the Open Source AS3 library corelib. But then I realized that the new features like uploading videos where not covered yet. Then I came to the blog of the author Martin Legris who blogged that he had problems using the new API. […]

  • April 21, 2008 at 9:38 am


    AS2 compatible with Youtube API? On a personal level, great blog!

  • May 6, 2008 at 7:11 am


    Did you succeed in using upload function from Youtube API wit AS3?

  • May 20, 2008 at 12:31 am


    You have done a wonderful job in creating the API.
    I tried to use your API in a Flex application.

    Take a look here

  • May 23, 2008 at 12:52 pm


    i have a flash who call a youtube video, but i don’t know how can i take out the button in the video that links to youtube site…

    i would like to have a nice fullscreen intro in my flash with youtube videos without possibility to click in the video, because on the top of the video i want to put a menu, contents, bla bla bla

    it is possible with the api… i’ve tried something like that but is not working

    thanks a lot!!


  • May 23, 2008 at 1:08 pm


    Nick: no the API is AS3 only… thanks for the comment.

  • May 23, 2008 at 1:09 pm


    Robert: simply put a sprite over the video that is playing (in the same container), draw a transparent fill into it (beginFill(0,0)) and that should do it!

    When you put items one over the other in AS3, unlike in AS2, it will cancel the events being fired on the elements underneath.

    In AS2 you needed to catch the events on the transparent MovieClip above the one you wanted to make inactive, but not so in AS3.

    Hope this helps!

  • May 23, 2008 at 1:10 pm


    Romain: I haven’t tried yet, but I don’t think it’s impossible. I’ve been particularly busy lately.. I will start working on the API again in the next weeks.

  • May 26, 2008 at 2:09 am


    taht works!!!
    … i am working in as2 and i made the movieclip inactive when i catched its event

    thanks mlegris

  • May 27, 2008 at 4:13 pm


    Regarding the Socket security issue, you can get around that restriction only if the network source contains a crossdomain.xml policy file that allows all ip addresses to connect to a specific port (ie 80) via the Socket class

    We just got to get Google to add this entry to their policy file

  • May 27, 2008 at 4:34 pm


    Oops. The comment system removed this from my previous post.

    allow-access-from domain=”*” to-ports=”80″

  • June 20, 2008 at 11:34 am


    Great library. Made a quick example in Flex using your library @

    Quick question:
    _developerKey value is hard coded, should it be replaced with the developers key or is it not used ?


  • January 11, 2010 at 12:16 pm


    Hi! Very nice post…
    Try the new youTube API example where you can
    search videos by keywords: tv, music, series, sports, entertainment, etc.
    the url of tv243 is

    Thanks for all

  • June 21, 2011 at 9:42 am


    Great work!
    Have you done any more development on this?
    I’m looking to include OAuth tokens, and request/authorise and access them via AS3.

    Could really use some help integrating this into your code.

Leave a Reply