Marty Henderson
Marty Henderson

Reputation: 95

Options for playing YouTube video in Adobe AIR application

I'm trying to get YouTube content into a Flex 3 AIR application and have tried a number of options using TubeLoc, wrapper as3 classes which all seem to not work.

Most recently, I've been trying the method I found at http://www.blackcj.com/blog/tag/youtube/, but still having difficulties with the code not being able to find ytplayer in the test.html. Have been wracking the brains trying to figure out where it should go but no luck.

Also tried to use an SWFLoader component, but no luck with it either... Basically, I've been trying to use it like this:

<mx:SWFLoader id="player2" source="http://www.youtube.com/swf/l.swf?video_id=xx" autoLoad="true" showBusyCursor="true" width="346" height="194" x="20" y="35"/>

but no luck with that either.

Does anyone have any articles or clear steps I can follow to try and get this working?

Upvotes: 0

Views: 2961

Answers (3)

Marty Henderson
Marty Henderson

Reputation: 95

Well, it seems that loading up the embedded YouTube player via HTML just won't work in my AIR application as the main application configuration has transparency enabled.

This is a bug in the AIR framework and it's just not going to work. Apparently an HTMLOverlay can be used to position a window on top of your application, but this smells like a fairly nasty hack to me.

Upvotes: 0

Jmaster
Jmaster

Reputation: 21

use the youtube chromless player it was made for embedding youtube videos

http://code.google.com/apis/youtube/chromeless_player_reference.html

Upvotes: 2

leolobato
leolobato

Reputation: 2379

I was using tubeloc to play YouTube video inside my Adobe Air application but it has some bugs which made me look for alternatives, which led me to your question and the link you suggested.

It has served me perfectly well. It's a lot simpler, specially if all you need is to play a video (or some videos).

About your issue:

but still having difficulties with the code not able to find ytplayer in the test.html. Have been wracking the brains trying to figure out where it should go but no luck.

It has happened to me whenever I had something wrong inside the HTML file. Make sure that the JavaScript synthax inside is correct and that the HTML itself is well formed.

Also, if you're importing those classes inside your project, don't forget that js folder. I did, and that was a reason for the same error.

If you need more than just play/pause a video, you can extend it's funcionality by taking a look at the YouTube API itself. It's quite simple, actually.

Anyways, thanks for providing that link and I hope you get it to work too. :)

Upvotes: 2

Related Questions