YouTube Data API ActionScript 3

13 actionscript,as3,flash,webservices,youtube  |   February 12, 2008  |     998

Hi Everyone,

so after a little research I found mostly outdated YouTube API’s out there. Even the ones on Adobe Labs refers to the pre-Google version of the YouTube API, which required a Key which you can’t get anymore.

So I set on a journey, a journey to build the AS3 Client Library for the YouTube Data API. 13 hours and 37 classes later, I’m about 90% done. I hardtyped everthing to make it completely auto-complete friendly. You have data-specific Iterators which spit out specific data objects, you have feeds, events, everything is a bit overkill but it makes it so you can explore everything from the auto-complete.

One thing I might need help with tho is documentation, if you’re interested in doing the Javadoc type work on it please leave a comment with some way I can contact you. If you don’t want to leave your email, feel free to leave your phone number!! haha.

I will go on and test things more in-depth tomorrow, or the next day. Then I will send it off to Adobe et YouTube/Google so they can make it official.

UPDATE

so I tested most things last night, they are working great!!!

I will post samples in the next few days. Thanks to Jeff for posting a crossdomain.xml file on the gdata.youtube.com host.

UPDATE

The project is now here: http://code.google.com/p/as3-youtube-data-api/ There are numerous posts on this website, check out the youtube category on the left!

Cheers!

Martin Legris

Comments
  • March 7, 2008 at 11:10 am

    Andrew E

    Hey Guys,
    I tried downloading the file but the link to the SVN is broken – any idea on when it will be fixed?

    Cheers!

  • March 7, 2008 at 12:01 pm

    mlegris

    I’ve posted the project on google code, here you go:
    http://code.google.com/p/as3-youtube-data-api/

    Plus click on the youtube category up left, you’ll get all the others posts on the subject..

    🙂

  • May 19, 2008 at 2:08 am

    Kefio

    Hi!
    i would like to know if there are any way to get the totalResults info feed (openSearch) using your API.
    thank you in advance!
    Alessandro

  • May 23, 2008 at 1:15 pm

    mlegris

    Kefio: yes it is. I use the JSON output on the API, it simplifies my life. At first I had managed to access all the XML elements (event the ones on namespaces openSearch and others), but it’s much easier with JSON.

    When you received results with the API I wrote, you get a (for example) VideoFeedEvent. Now from the event, letsay var evt:VideoFeedEvent, you can do evt.feed.totalResults to get what you want.

    The “feeds” are custom iterators that are hardtyped to everything the youtube API spits out, there are feeds for everything, it makes it real easy to manipulate the data.

    🙂

  • June 6, 2008 at 6:31 am

    kefio

    hi martin,

    thanks for your quick reply, i will try and let you know.
    another question:
    is it possible to get the geographical origin information about a youtube video?

  • June 19, 2008 at 11:14 am

    Richeffect

    Hi Martin,

    Something changed between yesterday and today, because now something in the API breaks.

  • June 19, 2008 at 11:15 am

    Richeffect

    Here is the error I get:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at ca.newcommerce.youtube.iterators::MediaContentIterator/get count()
    at ca.newcommerce.youtube.iterators::MediaContentIterator/getAt()
    at ca.newcommerce.youtube.iterators::MediaContentIterator/next()
    at ca.newcommerce.youtube.data::VideoData/get swfUrl()
    at topRated/doVideos()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at ca.newcommerce.youtube.webservice::YouTubeClient/doStdFeedLoaded()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

  • September 30, 2008 at 8:58 am

    luke

    I get the same error.. :(((

    Richeffect says:

    Here is the error I get:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.

  • February 16, 2009 at 11:53 pm

    jeff (YouTubeic)

    Thank you for such a great topic. I have learned a lot by reading on this website and great information.

  • April 2, 2009 at 2:20 pm

    Mikodite

    This is great, but where can I find the documentation for this so I can so much as know what parameters I need to use for functions like “getUserPlaylist” (I’m sure a string for the user is needed, but I can’t be sure that’s all you need.

  • August 8, 2009 at 6:29 am

    chuchu

    Hoi

    I have a question for {Martin} the Fx video player you make can i use it in my application and why it don’t play the video from the list?

    Thnx for so far

    Chuchu

  • September 3, 2009 at 7:23 am

    Josh Noble

    Thanks for this.

  • September 7, 2009 at 7:09 pm

    wow gold

    Great article. Thanks for the great resource.

Leave a Reply