Hi,
I'd like to know how I can embed the player in a site in full flash ?
Is there a tutorial or something for the v5 ?
I found things for the v4, but doesn't work on this version
Thanks !

Hi,
I'd like to know how I can embed the player in a site in full flash ?
Is there a tutorial or something for the v5 ?
I found things for the v4, but doesn't work on this version
Thanks !

Hi Ethan
I've a look in the code today,
Actually, I'm loading the player.swf, but I can't send config info to it :
This is basically the code :
private function videoLoaded( evt:Event ):void
{
_player = _videoplayer_loader.content;
_player.addEventListener(PlayerEvent.JWPLAYER_READY,playerReady);
addChild(_videoplayer_loader);
}
private function playerReady(evt:Event=null):void
{
_player.config.file = _plugininterface.videourl ;
_view = evt.target.view;
_view.sendEvent(ViewEvent.JWPLAYER_VIEW_PLAY);
_view.sendEvent(ViewEvent.JWPLAYER_VIEW_LOAD,_player.config);
}
My problem actually is for this line :
_player.config.file = _plugininterface.videourl ;
If I put in the videoLoaded function, the config is not ready, and if it's in the playerReady function, config is read only.
Is there a another event I can listen to send parameters to the config objet ?
Thanks ! ;-)

PS : I have the last version in the SVN / trunk

Hi,
Ok I've found a solution :
private function videoLoaded( evt:Event ):void
{
_player = _videoplayer_loader.content as Player ;
_player.addEventListener(PlayerEvent.JWPLAYER_READY,playerReady);
addChild(_videoplayer_loader);
}
private function playerReady(evt:Event):void
{
_player.load(videourl);
_player.play();
}
But (there is always a but ;-) ) the vidéo is loading, the sound is here, but nothing appears on the screen !
Is there something special to do ?
Thanks

Hi Ncolas,
Do you have a link?
Sorry, it's hard to debug things like this.
Best,
-Ethan

Hi,
You can have a look here :
I can't show my videos actually, so I took the one in your front screen, if you don't mind.
It seems that the videoplayer goes always below the main swf.
I've look in the code, and there are some stage.addChildAt( ... , 0); so this could be the reason.
Is there a way to not use the stage.addChildAt, but rather relative addChild (like this.addChild ...)
Also, I'd prefer to not change the actual code to update further version easily
Thanks

When I right click it says "about JW Player", so it obviously is there. There has to be a way in Flash to position it above your actual content. What layer is it on? (if any)

Hi Ethan,
The sprite are generated dynamically, so it's not easy so say on what layer it's on.
But you mean relative to the stage ? or the depth of the Display list ?

Yes, it would have to be on a higher depth.

I've found a solution by replacing the
RootReference.stage.addChildAt
by
RootReference.root.addChildAt
But now, I've two other questions :
- How can I set custom width and height size for the player (to not have the size of the stage ?)
- The video is always black when jwplayer is loading.
The player have to reach the end of the seek bar, and then I have to click play again, and then the video is displayed, and not a black screen.
How can I correct this bug ?
Thanks

Nicolas,
You need to set the image so it is not black. You can also set width and height, they are all variables. We really do not support custom Flash implementations though.
Best,
-Ethan

Hi Ethan,
Ok, I guess I should switch back to v4 or choose another player so ...
Regards,
Nicolas

Hi Nicolas,
If you are using v4 or v5 you will most likely run into issues embedding the player inside of another swf, it is just not what the player was intended to be used for.
Best,
-Ethan

Hello, did you have any luck embedding the player in another flash file? I'm about to try it so any information would be useful. Thankyou

Naomi,
This is not very easy to do, since the player was not intended to be used in this way.
Best,
-Ethan

HI Ethan. I don't mind if it involves a little bit of recoding the player, as I've already had to customise it somewhat anyway. Would it invole a lot? Or a little? Or is your expert opinion that if I want a video player inside another flash file to find another player altogether? Thnks for any advice.

It would take a fair amount of coding to do this.

ghi all
i can say that you can embed the player in another .fla - but you are in for some serious headaches. It takes quite a lot of working through the code (and in my case through the .as files also).

I noticed a lot of people pulling the player.swf in. If you are like me and prefer to compile it all together here is the code to get the config object passed to the player in flash.
Warning you have to edit the following source files: Configger, PlayerSetup, Player, IPlayer
Currently using JW Player 5.0.753 from Subversion (wish they would move to git, bzr, or hg for a pull request patching, hint hint).
First of all the loadConfig method in com.longtailvideo.jwplayer.utils.Configger (love the class name) only takes XML file from FlashVars or FlashVars, so we want it to take in a AS3 Object so add this method under "get config":
// Added by Joel Pittet for manual configuration
public function set config(params:Object):void {
loadCookies();
try {
for (var param:String in params) {
setConfigParam(param, params[param]);
}
dispatchEvent(new Event(Event.COMPLETE));
} catch (e:Error) {
dispatchEvent(new ErrorEvent(ErrorEvent.ERROR, false, false, e.message));
}
}Next we need a place to set this value, I chose inside the try block in loadConfig of the com.longtailvideo.jwplayer.controller.PlayerSetup. I swapped out the innards of the try block with:
// Joel Pittet
// Add config manually if the player has a flash config set
if (_player.hasFlashConfig) {
// Set the config object
configger.config = _player.flashConfig;
} else {
// load normally
configger.loadConfig();
}Now you will notice above there is a few properties on the _player object that don't exist yet. I added these to the Player class and IPlayer interface.
At the top of com.longtailvideo.jwplayer.player.IPlayer:
/**
* The set player's configuration by Actionscript
*/
function set flashConfig(params:Object):void;
/**
* The player's current configuration by Actionscript
*/
function get flashConfig():Object;
/**
* Checks to see if the _config object is empty
*/
function get hasFlashConfig():Boolean;In com.longtailvideo.jwplayer.player.Player after the constructor:
// Added by Joel Pittet for config settings
private var _flashConfig:Object = {};
// Set the flash based config object (used by PlayerSetup)
public function set flashConfig(params:Object):void {
_flashConfig = params;
}
// Get the flash based config object (used by PlayerSetup)
public function get flashConfig():Object {
return _flashConfig;
}
// checks to see if a flash config was passed in (used by PlayerSetup)
public function get hasFlashConfig():Boolean {
var isEmpty:Boolean = true;
for (var n in __flashConfig) { isEmpty = false; break; }
return ! isEmpty;
}
// End of Additions by Joel Pittet
Now for the fun part, testing. Create an AS3 flash file with a Class attached just outside the com dir. I called my class Main.as for my test.
Main.as
package {
import flash.display.Sprite;
import com.longtailvideo.jwplayer.player.Player;
public class Main extends Sprite {
private var player:Player;
public function Main():void {
var config = {
width: 300,
height: 240,
autostart: true,
file: '19492397.mov.mp4'
};
player = new Player();
// Must be called before added to the stage
player.flashConfig = config;
addChild(player);
}
}
}
Hi Nicolas,
This is not very easy to do because the player is not meant to be embedded in this way.
Best,
-Ethan