|
-
playing a YouTube video
Google has released the AS3 API for YouTube.
This means you can embed a chromeless player now inside your AS3 based KoolMoves project. Here's an example
Code:
var player:Object;
var yt_loader:Loader = new Loader();
yt_loader.contentLoaderInfo.addEventListener(Event.INIT, onYTLoaderInit);
yt_loader.load(new URLRequest("http://www.youtube.com/apiplayer?version=3"));
function onYTLoaderInit(e:Event):void {
// position the loader that contains the youtube player at (20, 20)
yt_loader.x = 20;
yt_loader.y = 20;
addChild(yt_loader);
// set the event listeners
player = yt_loader.content;
player.addEventListener("onReady", onPlayerReady);
player.addEventListener("onError", onPlayerError);
}
function onPlayerError(e:Event):void {
trace("player error:", e.data);
}
function onPlayerReady(e:Event):void {
// setup the player
player.setSize(320, 240);
player.setVolume(70);
// load the video
// replace the first parameter with your own video id
player.loadVideoById("AnWkTRnUuTU", 0, "default");
}
For the complete API reference, see http://code.google.com/intl/nl/apis/...reference.html
Last edited by w.brants; 10-15-2009 at 09:22 AM.
-
KoolMoves Moderator
-
Senior Member
That's pretty cool! Thanks for sharing Wilbert!
-
up to my .as in code
YouTube Search
http://www.km-codex.com/?p=574
Nicely done as always Wilbert
-
A very nice example Chris.
How did you do the search ?
-
up to my .as in code
Using the API pages you linked to....specifically this one:
http://code.google.com/intl/nl/apis/...arameters.html
You can squeeze out up to 50 results and then it's just a matter of using some string manipulation/extraction and xml building to create a playlist. Really impressed with this one Wilbert. It is quite simply a great addition to the already outstanding arsenal of goodies AS3 support has offered Koolmoves users.
Last edited by Chris_Seahorn; 10-17-2009 at 06:39 AM.
-
Thanks a lot Chris.
I didn't realize it was relatively easy. Maybe I could add a feature that sets a playlist of all videos of a specific YouTube user.
-
up to my .as in code
Look out folks..Wilbert is on a roll 
http://www.km-codex.com/?p=586
Even more coming on this......
-
I like the new example you created Chris.
The search works very nice and the info you can view about a video works great.
-
up to my .as in code
I'll be giving away that source later today. I will be coding a YouTube bandit based on SWFStudio and Koolmoves and will also post that for download once I build it.
You know........ I don't take for granted how kind you and Bob are to me. You both always keep me in the loop about new things, keep sending me beta's even though on face value I may be inactive (but am usually doing something that may not be reflected by the CODEX or forum activity), listen to suggestions and feature requests I make and much more. I've been online friends with you both for a long time now and hope you both know it is my pleasure to be aquainted with you, watch you both constantly display your brilliance through your coding and an honor to call you both friends. Much like my own children, Koolmoves is like a child to me that I have watched grow with pride. You should both be very proud of what you have accomplished.
-
-
up to my .as in code
The Source code is in the KM-CODEX downloads. Once Wilbert and Bob distribute the new classes (Mediaplayer and PlaylistCreator) it will work for7.2.2 users upon opening
-
Once Wilbert and Bob distribute the new classes
When is that suppose to happen?
Steven
-
 Originally Posted by shx
When is that suppose to happen?
KoolMoves 7.3 or if you are a beta tester, the most recent beta.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|