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
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 Main$iinit()[C:\work\web\New Project\classes\Main.as:14]
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 adobe.com can connect only to a server daemon at adobe.com.
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.
[…] 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. […]
AS2 compatible with Youtube API? On a personal level, great blog!
Did you succeed in using upload function from Youtube API wit AS3?
You have done a wonderful job in creating the API.
I tried to use your API in a Flex application.
Take a look here
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!!
Nick: no the API is AS3 only… thanks for the comment.
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!
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.
… i am working in as2 and i made the movieclip inactive when i catched its event
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
Oops. The comment system removed this from my previous post.
allow-access-from domain=”*” to-ports=”80″
Great library. Made a quick example in Flex using your library @ http://www.dehash.com/?p=75
_developerKey value is hard coded, should it be replaced with the developers key or is it not used ?
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 http://www.tv243.com/
Thanks for all
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.