Tuesday, October 20, 2009

New Youtube AS3 API

That sound you hear is angels singing hallelujah whilst beams of light shine down upon our unworthy faces. Youtube have finally released an AS3 version of their chromeless API:


If only they'd have released it 2 months ago.

Initially it's fantastic and really easy to use. The code example works, you can monitor and change the video quality and it's fairly smooth. Then the record scratches and you run into some problems.

Firstly the destroy(() function hasn't been implemented yet. At first glance this was a deal breaker, but someone else suggested using a hack and just requesting a non-existent video, which stops the stream. player.loadVideoById("Youtube are jokers") works well, though if I was building an app that was showing lots and lots of different video (the one I'm on will probably only have 5-10 max) I would be concerned.

Also the embed code coming from it doesn't work. This is less serious (I was very tempted to just leave it and hope no one noticed until Youtube fixed it) but I'm still not sure how to find a nice workaround. I might have to just write a function that manually assembles the code. Not optimal but it will probably work.

No comments: