YouTube Data API Changes and Player API

If you haven't heard the big news yet, the YouTube Data API has been updated and the YouTube Player APIs have been released. The APIs look very interesting with some much wanted features.

The below is the big news from the YouTube Blog.

Here's the sound byte: We now support upload, other write operations, and internationalized standard feeds. (And there was much rejoicing!) We're also introducing player APIs and a chromeless player -- a barebones player SWF that's fully customizable and controllable using the player APIs.

The Data API now allows for reading (nothing new), writing and uploading of data (the latter two are the big news). The API allows for you to do many things that can be done in YouTube, such as add comments about a video or upload videos to YouTube. Libraries for the API are available for Java and PHP (sorry Ruby developers at least for now).

You can read more about the Data API here.

The Player APIs now offer a Flash (Actionscript 2.0) API and a JavaScript API to allow more control over the player. The JavaScript API and Flash API are very similar (which makes since as they are both based on ECMA Script). The APIs have some very powerful hooks into the videos. My personal favorite hook is player.getPlayerState() which returns the state of the player. Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).

You can read about the JavaScript API here and the Flash API here (note that the Flash API is almost exactly the same as the JavaScript API, so you will need to read both references if you are going to use the Flash API).

Perhaps Even bigger news is the release of the chromeless player. Below is an excerpt about the chromeless player from reference.

Getting Started

First off, you need a developer key. To register for one, visit the registration page.

The chromeless player consists of two SWF files. apiplayer.SWF contains the actual video playing functionality. cl.SWF is a loader SWF that loads apiplayer.SWF and exposes the player's API functions. It also provides security sandbox restrictions for the apiplayer.SWF, so loading SWFs cannot access elements inside the player directly.

The player can be controlled via two methods — by loading the SWF into another SWF (or Flash website, etc.), or by embedding it directly in an HTML page and using JavaScript to control the player. The JavaScript controls are identical to the embedded player's JavaScript API.

The URL to load the chromeless player SWF is:

http://gdata.youtube.com/apiplayer?key=DEV_KEY

Functions

The following operations are available in addition to the ones listed in the JavaScript API documentation.

loadVideoById(videoId:String, startSeconds:Number):Void
Load the specified video and starts playing the video. If startSeconds (number can be a float) is specified, the video will start from the closest keyframe to the specified time.
cueVideoById(videoId:String, startSeconds:Number):Void
Loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until playVideo() or seekTo() is called. startSeconds accepts a float/integer and specifies the time that the video should start playing from when playVideo() is called. If you specify startSeconds and then call seekTo(), the startSeconds is forgotten and the player plays from the time specified in the seekTo() call. When the video is cued and ready to play, the player will broadcast a video cued event (5).
setSize(width:Number, height:Number):Void
Sets the size of the chromeless player. This method should be used in favor of setting the width + height of the MovieClip directly. Note that this method does not constrain the proportions of the video player, so you will need to maintain a 4:3 aspect ratio. When embedding the player directly in HTML, the size is updated automatically to the Stage.width and Stage.height values, so there is no need to call setSize() when embedding the chromeless player directly into an HTML page. The default size of the SWF when loaded into another SWF is 320px by 240px.

You can read more about the new features at the YouTube API Blog.

I think that these new feature really make it possible to make some great mash-ups with YouTube. If you create a cool mash-up using some of the new features of the API or use the the Player APIs or use the chromeless player then I would love to hear about it (you can leave it in the comments or you can write a blog post about it using your free Ajaxonomy account.





Digg!Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
 
< Prev   Next >

Thoughts for the Week

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/general/thoughts-for-the-week/.
Well another week down, and what a week it has been! Not only has it been busy…     Readmore

WP Advanced Code Editor

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/announcements/wp-advanced-code-editor/.
For those interested, I wrote a plugin for Techlyzer.com that was just released. It’s called     Readmore

Check Out My Other Home: Techlyzer.com

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/general/check-out-my-other-home-techlyzercom/.
Hi all. I’m happy to announce the launch of a new website that I’ll be trying to…     Readmore

Gadget Advisor Blog

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/reviews/gadget-advisor-blog/.
Being a tech-centric blog I’m always on the lookout for other technology related websites. For those with…     Readmore

Updates to Permalinks

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/announcements/updates-to-permalinks/.
After a lot of deliberation I’ve changed the permalink structure of Simply-Basic. When I started the blog…     Readmore

Qwest Web.Help: Stop Hijacking My Browser (How to Opt-Out)

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941493.
Earlier today I was surfing the web and mistyped a URL. Rather then getting the customary “The…     Readmore

Change Default File Type and Path for Screen Captures [Mac Tips]

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941482.
Mac only - I frequently use Mac’s built in screen capture ability to create the images you…     Readmore

Coming Soon: Comment on Lifehacker Using Your Facebook ID

Copyright © 2008 John Kolbert. Visit the original article at http://simply-basic.com/posts/1941478.
I just noticed that Lifehacker is joining the ranks of sites using the new Facebook Connect,…     Readmore

dealdotcom
Earn $$ with WidgetBucks!