In this tutorial I will demonstrate how to use the YouTube Data API AS3 Library to:
So let’s get started
So far we’ve defined our class, SearchSample, and two member variables: _ws (which will contain a reference to the YouTubeClient singleton) and _requestId (to store the unique id associated with our specific request).
Next we will get a reference to the YouTubeClient class, listen for the proper event, launch our search request and store the requestId associated with it.
Now on with the event handler, doSearchResults. We will:
That’s it folks! The project is now available at Google Code, here: http://code.google.com/p/as3-youtube-data-api/
I could use help with documentation, if anybody feels up to the task, leave your email or contact info in a comment!
Hello, Im trying to play with this great library but i cant make it work on browser…inside flash everything its fine. Its crossdomain working???
sorry, sorry, sorry
i just read the previuos post and its working really fine !!!!
thanks a lot
Getting the following error on doLogin:
ArgumentError: Error #2096: The HTTP request header Authorization cannot be set via ActionScript.
Can you advise please? Thanks
when I try to load video.swfUrl on stage, it displays a warning in debug:
Warning: Domain i.ytimg.com does not specify a meta-policy. Applying default meta-policy ‘all’. This configuration is deprecated. See http://www.adobe.com/go/strict_policy_files to fix this problem.
Do you can help me?
I am working on a version which uses a AMFPHP Proxy. This problem you had is caused by the security sandbox from the Flash Player, by using a proxy we have complete freedom. In PHP and most other programming languages you don’t have these (stupid) limitations. I use cURL to make the requests, and return the responses using AMFPHP. It works quite nice. I recently posted on it. The API will be updated shortly.
this problem is due to the crossdomain.xml policy file found on i.ytimg.com, over which I have no control. I suggest posting this comment in the google group on the Youtube Data API developer forum.
[…] Youtube Data API AS3 – Tutorial […]
Great post! Have you updated API with the fix for policy issue?
i really liked this AS3 Classes, but i can´t download from code.google…there is a problem? –
I’m a AS3 new beginner and I’ve read your sample code in this article. But when I press Ctrl + Enter to test, it show: “Error:5000, it must have sub-class “flash.display.MovieClip”
Then I import flash.display.MovieClip, but still pop the same error code 5000. Could you kindly give me some suggestions?
Thanks a lot!!
I tried to use the method getVideo from YouTubeFeedClient class, but I have the next message:
The code it is the follow:
_ws = YouTubeClient.getInstance();
_requestId = _ws.getVideos(“uEGPF1be6RM”);
anyone know, what happend?
[…] Youtube Data API AS3 […]
Impressive work indeed, and its really amazing the kind of interaction with Youtube you can acchieve.
I am having a really annoying problem though, where amidst all the data can I retrive the URL to the netstream I need to connect my Video player to actually play the stream?
Okay…I think I must be a complete idiot, cause I’m really having a hard time getting this. (Though I’m making progress)
I’m trying to get a the ten most recently uploaded videos from a particular youtube account, and I just can’t seem to make it happen.
(I think I need to use “VideoFeedEvent.VIDEO_DATA_RECEIVED”, but I’m not sure how to do it…)
So far, this is the most mack-daddy site that I’ve found for the youtube API. Can somebody please help me? PLEASE!!!
Okay…I figured it out. The latest download (0.95) gets a little confused, because the test files and classes are trying to access YouTubeClient.as and it doesn’t exist anymore. (They are now YouTubeDataClient.as & YouTubeFeedClient.as)
Simply switch it to the most appropriate file and you’ll be golden.
Now, if I can just figure out how to attach my new content to items on my stage I’ll be crazy happy!
Two days later…still trying to figure out the getAt method. ARGH!!!
I think that’s how I need to call specific lines from the feed.
Great work!!! works great in flash builder 4 too
I found these issues when I am using this api to our project,can any one help me:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ca.newcommerce.youtube.iterators::ThumbnailIterator/get count()