ActionScript 3.0 API’s Examined: YouTube up first!

YouTube API Basic ExampleIf you didn’t see the list of 22 ActionScript 3.0 API’s that I posted you might want to take a look. To continue exploring the API’s I have decided to begin creating simple examples for 10 of the 22 from the previous post. I have broken these 10 into the following categories: Media, Social Networking, Marketplace, Misc and 3D. Currently on the line up: YouTube, Odeo, Flickr, Facebook, Twitter, del.icio.us, Amazon, ebay, Away3D, Papervision3D.

First up is the uber popular YouTube.com. I was disappointed that the YouTube API does not have a means to provide a path to the raw FLV file via the API. That would be loads of fun considering what can be done with video in the Flash Player.

I started with the YouTube API hoping that pulling in video data would be supported, oh well. I did notice another YouTube example that Ted Patrick created that does appear to pull in the actual video. I was getting a #2044 error from his example so I wasn’t able to see that in action. I also received the same error when trying to upload this example to my server. That is why the working SWF/HTML isn’t available.

You can view the source here. You can also download the source here. Once you get the example set up in Flex Builder the #2044 error should cease. If anyone has any info on this please drop me a line..

This example uses Adobe’s as3youtubelib and as3corelib. You will need to download these using Tortoise SVN. Here is a decent looking tutorial on that if you need. Once you get the libraries downloaded you’ll need to add them to your Flex project’s Build Path.

The UI for this example has a very basic October/Halloween theme. I used a piece of vector art for the background and then used a Halloweeny typeface to kick up the look and feel a notch.

For the Top Ten video display a TileList was used. The TileList uses a drop in ItemRenderer.

One minor issue I had with the as3youtubelib was with regard to data binding. I ended up needing to create my own custom, bindable VideoVO class. This is because the properties of the as3youtube Video class are not bindable. I could be doing something incorrectly here, again drop me a line or leave a comment with any suggestions, info etc.

The next API slated is the popular podcasting service Odeo. I hope to keep these examples as simple as possible. Leave a comment with questions or suggestions.

And don’t forget to: “Flex it up a notch!”

4 Responses to “ActionScript 3.0 API’s Examined: YouTube up first!”

  1. interesting post there, i do involve a lot with youtube videos lately…can u suggest ways to make our videos look better after we upload them ?

  2. Hello,

    Nice work with the example :)
    I keep getting the following error:

    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at YouTubeBasicExample/::onFeaturedVideos()

    I have had a look around and cant find a solution

    could you help?

  3. Hi, Im trying to develop some experimental app with this API´s but with Flash CS3 and I cant make it work. This libraries only works on Flex??? Its possible do it with not Flex???

    thanks

  4. Hello, I am trying to alter your code ever so slightly to pull down videos by tag. However I keep getting an error from YouTubeServiceEvent. The error that comes back is #8: Bad, unknown, or disabled dev_id specified.

    Now I have an uptodate API key…but no where in your code are they asking for the Client ID. I’m not exactly sure what dev_id is if it isn’t those two things. I’ve googled the problem and seen a lot of other people with the same issue…but no ideas on how to resolve it. I know there is a YouTube Data API for AS3 out now…but it offers now way to sort by a submitted tag.

    Any ideas?

Leave a Reply