Home
>
Youtube,
Youtube Wrapper > Youtube AS3 Wrapper – Downloads
Youtube AS3 Wrapper – Downloads
Here you can download the files
Note: The latest wrapper available for download is at the bottom of this page!
DOWNLOAD WRAPPER v0.6
DOWNLOAD TEST HARNESS SOURCES
EDIT March 29, 2009 @ 3:17
ADDED NEW v0.7 Youtube AS3 Wrapper
DOWNLOAD WRAPPER v0.7
DOWNLOAD TEST HARNESS SOURCES v1.1
EDIT April 21, 2009 @ 23:22
ADDED NEW v0.7.1 Youtube AS3 Wrapper
DOWNLOAD WRAPPER v0.7.1
DOWNLOAD TEST HARNESS – AIR SOURCES v1.0
EDIT June 03, 2009 @ 18:58
ADDED NEW v0.7.2 Youtube AS3 Wrapper
DOWNLOAD WRAPPER v0.7.2
EDIT July 12, 2009 @ 22:48
ADDED NEW v0.8.0m Youtube AS3 Wrapper
DOWNLOAD WRAPPER v0.8.0m
DOWNLOAD Youtube Test Player – Flash sources v1.0
admin Youtube, Youtube Wrapper Actionscript 3.0, as3, download, harness, test, wrapper, Youtube
Hi,
I’m interested in using your YouTube wrapper but sadly it doesn’t appear to work in an AIR app.
SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()
at pinosh.ytLCAS3Wrapper::YtLCAS3Wrapper()
Any plans for an AIR-compatible release or a code release?
Cheers,
Rob
Hi, it does not yet work with AIR due to the way AIR modifies connection names in LocalConnection.
This should be fixed in a next release.
Ovidiu
I would like to announce that a new version, v0.7.1, of Youtube AS3 Wrapper is available for download.
This new version adds Adobe AIR support.
Best Regards,
Ovidiu
Hey,
I am creating a videolibrary using your api , when I load more then one youtube player it doesn,t appear on the stage… is there a solution that you know? do you also had this problem?
the code I use to add all the youtube players is:
//get all youtube videos
for (var j:int=0;j < arrYoutubePlayers.length;j++){
trace(”cretating a youtube player”)
trace(”youtube url: “+ arrYoutubePlayers[j].url)
var yplayer:YoutubePlayer = new YoutubePlayer(getYouTubeVideoUrl(arrYoutubePlayers[j].url));
arrAllPlayers.push(objYt);
}
and then later I all add them to my stage ,thx in advance
Unfortunatelly more than 1 instance of the player loaded on the same stage will not work.
@admin
Is this a bug which is going to be fixed in the near future? or not?
Yes this is a known bug that will be fixed in a future release.
Hi Ovidiu,
I’m building a wrapper for myself and calls to setVolume seems not to work at all. Did you face this issue and knows how to fix it?
Many thanks!
The volume problem is fixed since wrapper v0.7 so you can use any of v0.7 or v0.7.1.
I’m using LocalConnection to communicate with the player (not your wrapper) and I’m wondering if you could share how you solve the volume problem?
Thanks
Thanks Ovidiu!
Hi, my name is rony.
Is the 2 instances problem is about to fixed in the near future (margin of weeks?)
tnx
Any specific reason this would be working on one site and not another. I had gotten this working on a test site, and when I transferred it over to the live site it won’t load the you tube video.
You should make sure that you have the 2 swf files ytPlayer.swf and ytODLCWrapper.swf placed in the same directory, in a directory accessible by the main swf of your app.
Also a policy file that allows access to the resources should be located at the root of your site.
Other than this, it should work all ok.
Hi,
I encountered the same problem as Jeff. The 2 files ytPlayer.swf and ytODLCWrapper.swf are in the same directory. I set a crossdomain.xml file with totally open policy, .
But my application works only from localhost locally and not from the testing location.
It keeps working only if I access directly via the IP address of the server (http://10.0.0.1:8080/myApp/index.html). If I access through the alias name (http://devmachine:8080/myApp/index.html), when it has to load the player, I see through the Firefox “Net” view that it loads the ytPlayer.swf and ytODLCWrapper.swf, but then there are not further calls, and it stops and the player is never loaded. In the working version (i.e. through the IP access) it makes the next call to http://www.youtube.com/apiplayer to get the player and the player appears.
Do you know what the problem can be? Thanks in advance
Hi,
The problem lies with LocalConnection and the security built in the wrapper. Basically, the wrapper only allows connection if the domains of both Local connections match.
The connection is rejected because the second LocalConnection object has the domain in the ip format, but the first one has the alias.
You should also make sure that you don’t try to load the wrapper swf (ytPlayer.swf) from a remote destination, because that will not work.
You should always keep the wrapper files in the same directory (or a subdirectory) of your main swf.
it doesn’t seem to work when you want to load more than one video into the same player. On stop or clearVideo or stopAndClearVideo I am unable to load another video or even get the youtube player
You can’t load 2 instances on the same stage. the second instance will never load. You can play any number of videos in 1 instance however.
You can’t test in Flash IDE because the wrapper won’t load.
For detailed documentation please check the Youtube AS3 Wrapper page on this blog.
Ovidiu
Ok i got you. I got it to work after a bit of fiddling around and some ingenious debugging…
My problem now comes to when i “move away” from my “video area” and go to somewhere else. It is noted that I would need to (in your case) clear or stop the video to avoid any “residue” of the video being loaded. What could be the best way of “unloading” the video when I move away or exit as I have numerous exit points so i’m trying for something that is “global”
Nope this isn’t working. I used a stopAndClearVideo along with a destroyAndReload and on leaving and coming back to the video area. I cannot re-instantiate the player. Is there anything else that I may have missed here? the class is attached to a movieclip on the time line. so the playhead is going to “jump off” and then “jump back in” in navigating tru the flash…This was the same problem I was encountering for all Youtube wrappers I had seen and tried to use.
Ok.
If you want to stop the current video from loading you can use the stopVideo() method or the stopAndClearVideo(). Once you call any of these functions, in order to play the video again, or another video, you must use the loadVideo or cueVideo methods.
If you will never use the player again, you may call destroy. The player cannot be used until it is reloaded using the reload method. You will again receive the PLAYER_READY event when the player is ready to receive other calls.
Ovidiu
Nope this isn’t working either.
i tried using a destroyAndReload but it isnt working…heres a snippet from a class I made with the
————->
modalScreen = this.screen;
modalScreen.addEventListener(MouseEvent.CLICK,playerStopPlaying);
modalScreen.buttonMode = true;
}
public function playerStopPlaying(e) {
//this.player.stopAndClearVideo();
videoID = ”;
this.player.destroyAndReload();
this.visible = false;
}
public function loadYouTubeVideo(ID) {
var t:TextField = youtubeText as TextField;
if (videoID != ”) {
t.text = ‘Player is on ‘+ this.player.getPlayerState();
this.player.stopVideo();
}
this.videoID = ID;
this.player.loadVideo(videoID);
t.text = ‘Player was on ‘+ this.player.getPlayerState();
// this.player.stopVideo();
// trace(videoID);
//t.text = ‘Player is now ‘+ this.player.getPlayerState();
}
I’m using destroyAndReload because I atleast need to know that when I move away from the video player I can get it back. All i really need it to do is stop playing the video…and then be ready in the event it has to load another one.
this isnt working though this isnt working
Ok I see.
I hope you listen again for PLAYER_READY event after calling destroyAndReload.
Also you should always check to see if the player is ready before calling any play or load function on it: isPlayerReady() returns true if if it’s ready to play videos. After you call destroyAndReload it will return false until the PLAYER_READY event is received.
However you shouldn’t need to use this function.
You should only use stopVideo if you only want to stop the video from continuing loading. The call loadVideo again.
If you follow these steps it should definitely work.
doesnt destroying and reloading destroys the object then reloads it…well i wud have expected that the reloading wud re trigger a Player_READY wouldnt it?
ok i tried this
———
public function unloadPlayer(){
//loader.unload();
this.player.addEventListener(YoutubeEvent.PLAYER_READY, this.onYTPlayerReady);
this.player.destroyAndReload();
}
————-
but i’m not receiving ANY PLAYER_READY event.
i’m triggering this action in the middle of a video being played, when the player itself has loaded and ready to play and still nothing….are you sure about this? this could be a new bug
ok this isnt working either…. on triggering an destroy and reload i DON’T get any PLAYER_READY event being fired off. its as if the player was unloaded and a connection cannot be made again. What exactly happens when you destroy?
is there any way that you can expose the local connection object? I’m not getting anything events dispatched after destroying or reloading. now i had been researching and they said that there is some issue about calling destroy from the youtube player from the outside…i dunno what they mean by that but I guess its what is causing the bug in your wrapper as well as everyone elses. nice try though…;-)
Any changes on this?
I´m trying to use the example, but the “player” doesn´t dispachs any event… Could someone help me?
Can’t the ytPlayer.swf and ytODLCWrapper.swf files be included (like the other .as files) in the library swc so that we don’t have to add them to our SRC folder?
First of all the 2 swf’s shouldn’t be in the SRC folder, rather in the deploy one. Because you have to keep those swf’s wherever you move you main project swf file.
Secondly, ytODLCWrapper.swf is AS2 and ytPlayer.swf is AS3, your project is AS3, so the 2 can’t be mixed together, they must be separate.
I would like to announce the new Youtube AS3 Wrapper v0.8.0m.
This new version of the wrapper support multiple videos in the same time on the same stage.
A sample has been added in Youtube AS3 Multiple Instances Sample.
Enjoy!
Hi – can you do multiple videos in same swf with flash?
Yes. 0.8.0m version of the wrapper supports this.
Please refer to the changelog.
What are the license terms for using your code and SWFs? Thanks!
You can use it in any way you like it, just attribute what appropriate to Ovidiu Diac through a link to this website.
Creative commons license 3.0: http://creativecommons.org/licenses/by/3.0/
Best regards.
Ok, thanks! Do you provide the AS2 code? I don’t see it anywhere in the downloads.
@admin
Ok thanks! Is the AS2 code available? I don’t see it in the downloads.
No the code is not available.
hello
im having a bit of a problem, i have the video player on my library.. i add it to stage on user comand, then the user can remove it from stage again.
when i add another time from the library this will not work, why?
thanks in advance
I have a popup in which i am playing playing the you tube movie. It plays fine when i first open the popup but if I close the popup and then re-open it..the stage is blank and the you tube control does not get added. Any idea where I am going wrong ?
Hi,
Which version are you using?
Hey,
Which version are you using?
@admin
Using vresion v0.8.0m. Below is the code for the close button of the popup. Anything wrong here?
private function closeWin():void
{
this.ytPlayer.stopAndClearVideo();
this.ytPlayer.destroyAndReload();
stopTimers();
dispatchEvent(new Event(”closeWin”,true,false));
}
using the latest version 0.8m. Below is the code for the close button of the popup. Anything wrong here?
private function closeWin():void
{
this.ytPlayer.stopAndClearVideo();
this.ytPlayer.destroyAndReload();
stopTimers();
dispatchEvent(new Event(”closeWin”,true,false));
}
AM using the latest version 0.8m. Below is the code for the close button of the popup. Anything wrong here?
private function closeWin():void
{
this.ytPlayer.stopAndClearVideo();
this.ytPlayer.destroyAndReload();
stopTimers();
dispatchEvent(new Event(”closeWin”,true,false));
}
Any luck on this one?
Don’t use destroyAndReload, that method is deprecated and shouldn’t be used. You should be just fine if you just use one of the load functions anytime you want to play a video. After calling stopAndClearVideo(), if you want to play the same video you have to load the video again using a load function. For more info, refer to documentation section. Regards
@admin
Is there any Flex example of playing multiple videos in the same swf? I couldnt find one.
Playing multiple videos in the same time no, but actionscript is the same in Flash and Flex.
However examples of playing multiple videos, one-by-one, you can download the sources of the TestHarness-player.
Refer to downloads section.
Download the TestHarness-player that’s related to wrapper version 0.7.2.
Cheers