Go
Not registered? Sign up!

Recompile 4.0 with FlashDevelop, FDT or Flex SDK

Google Translate
13 posts | return to the General Chat forum | get the rss feed for this thread

Jul. 29, 2008webmania

Hi all,

I'd like to make some modifications to the JW FLV player 4.0 and then recompile it with the free FlashDevelop and FlexSDK 3.0 from Adobe. I can't seem to get it to work, does anybody have experience making this work?

Thanks,

webmania

Jul. 29, 2008JeroenW

I haven't tested this, but would like to get this working. Do you do this on a MAC (is this possible on a MAC)? And what errors do you get when compiling?

Jul. 31, 2008webmania

I created an as3project and this is what I am getting:

Running process: C:\Program Files\FlashDevelop\FirstRun\Tools\fdbuild\fdbuild.exe "D:\svn\jwplayer4\talesplayer.as3proj" -ipc 023c88f2-8d27-481b-86e5-9b3850eda66d -compiler "C:\FlexSDK3" -library "C:\Program Files\FlashDevelop\FirstRun\Library"
Using the Flex Compiler Shell.
Building talesplayer
mxmlc -load-config+=obj\talesplayerConfig.xml -debug=true -incremental=true -benchmark=false -warnings=false -o obj\talesplayer633512002730937500
INITIALIZING: Adobe Flex Compiler SHell (fcsh)
D:\svn\jwplayer4\com\jeroenwijering\events\AbstractView.as(25): col: 63 Warning: return value for function 'addControllerListener' has no type declaration.
public function addControllerListener(typ:String,fcn:Function) {};
^
D:\svn\jwplayer4\com\jeroenwijering\events\AbstractView.as(26): col: 58 Warning: return value for function 'addModelListener' has no type declaration.
public function addModelListener(typ:String,fcn:Function) {};
.....


this goes on for a while and eventually I get

.....
D:\svn\jwplayer4\com\jeroenwijering\models\RTMPModel.as(237): col: 7 Warning: variable 'dur' has no type declaration.
var dur = model.playlist[model.config['item']]['duration'];
^
D:\svn\jwplayer4\com\jeroenwijering\models\RTMPModel.as(253): col: 35 Warning: return value for function 'volume' has no type declaration.
public function volume(vol:Number) {
^
Build halted with errors (mxmlc).

I looked through all the error messages and they all seem to be warning messages with regard to the type declaration, though.

Thanks,

webmania

Jul. 31, 2008webmania

P.S.

I looked at the symbols contained in my output swf file (yes, the compilation does produce one even though it failed) and the stock player.swf. I noticed that the only difference is that the stock swf file contains all the player_fla* stuff. This makes me wonder maybe I am really close, if I can get FlashDeveloper to use player.fla somehow.

Jul. 31, 2008PabloS

Hi -

Somewhere in the mess of warnings you're getting from mxmlc, can you see if you are getting any errors? I find it strange that mxmlc is outputting warnings, since the -warnings=false flag is set by FlashDevelop...

Jul. 31, 2008webmania

I went through all the messages thoroughly (I think), and didn't find any "error" messages, all "warning", which might explain why I am still getting an SWF file....

But apparently mxmlc or any other command line compilers cannot handle FLA files, so maybe I should ask for the SWC file, which FlashDevelop apparently can handle...

Aug. 05, 2008JeroenW

Hmm, strange the mxmlc compiler needs type declarations and the CS3 compiler not. I agree with Pablo, this shouldn't be what causes the compiler to fail.

Aug. 19, 2008nada

hola!

we would like to share our experience when we were trying to use JW Player with FDT to show media in our flash projects.
you could not just load it with Loader or use the generated SWC with FDT. As we can see in your forum, with FlexBuilder
there seems to be some trouble with this too.

the swf problem
when you load JW Player with the Loader Class, the MovieClip.stage object used by the Skinner is instantiated before the
player is added to the stage, therefore it is null which causes the player to crash.

the swc problem
there is no Player.player property due to the nature of the SWC. the Skinner/Configger crashes.

our solution

1. in the FLA, export the player library symbol with Identifyer 'AssetPlayer'.
rest of the settings remain default: base class is 'flash.display.MovieClip', exporting for AS/first frame is checked.
this will be needed for the swc version

2. modify com.jeroenwijering.player.Player

/** Constructor; Loads config parameters.**/
public function Player() {
visible = false;

/* *******************************************************
* begin fdt mod:::
* ----------------
* wait to kick off player until really added to stage
* else you will have null in the stage property of the skin
* and you will not be able to compile in fdt
*/

// wait till the object is really added to stage
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

/*
* --------------
* end fdt mod:::
* ******************************************************* */
};

/* *******************************************************
* begin fdt mod:::
* ----------------
*/

/**
* the kickoff is postboned until the player is added to stage
*/
private function onAddedToStage(e : Event) : void {
// clean up
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);

// if your using the swc approach no player instance is on the stage
if(this.player == null)
{
this.player = new AssetPlayer();
addChild(this.player);
}

//now everything goes the known way
configger = new Configger(this);
configger.addEventListener(Event.COMPLETE,configHandler);
configger.load(defaults);
}

/*
* --------------
* end fdt mod:::
* ******************************************************* */


3. For the swc option we added a simple getter setter to access the default values to the com.jeroenwijering.player.Player

[...]

public class Player extends MovieClip {


/** A list with all default configuration values. **/
//use an underscore
private var _defaults:Object = {
author:undefined,

[...]

/* *******************************************************
* begin fdt mod:::
* ----------------
*/

/**
* setter for accessing the default object via AS3
*/
public function set defaults(o:Object):void
{
for(var id:String in o)
{
_defaults[id] = o[id];
}
}

/**
* getter for accessing the default object via AS3
*/
public function get defaults():Object
{
return _defaults;
}

/*
* --------------
* end fdt mod:::
* ******************************************************* */

[...]


4. Recompile and use either the swf or swc.

Theres 2 simple examples how to use:

package
{
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLVariables;

//class definition
public class ApplicationExampleSWF extends Sprite
{

private var loader:Loader;

/* ----------------------------------------------------------------- */

public function Application() {
addJWPlayer();
}

private function addJWPlayer():void
{
loader = new Loader();

var url:String = "player.swf";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.file = "video.flv";
request.data = variables;

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onJWPlayerLoaded);
loader.load(request);
}

private function onJWPlayerLoaded( evt:Event ):void {
//this will kick off the player
addChild(loader);
}

}
}


package
{
import flash.display.Sprite;

//class definition
public class ApplicationExampleSWC extends Sprite
{

public function Application() {
addJWPlayer();
}

private function addJWPlayer():void
{
var player : Player = new Player();
player.defaults = {file:"video.flv"};
addChild(player);
}

}
}


Hoping to have helped you a little bit ;-)

grx
nada

Aug. 20, 2008nada

another problem.
the player resizes automatically to stage.stageWidth/stage.stageHeight, but if you embed it in your flash pages you may want it to resize it to your desired sizes.
quick fix: listen to the View's Resize event and resize it again if different from your desired dimensions...


package {
import flash.display.Sprite;

import com.jeroenwijering.events.ViewEvent;
import com.jeroenwijering.player.Player;

//class definition
public class Application extends Sprite
{
private var player:Player;
private var pWidth:uint = 320;
private var pHeight:uint = 200;

/* ----------------------------------------------------------------- */

public function Application() {
addSWCJWPlayer();
}

/* ----------------------------------------------------------------- */

private function addSWCJWPlayer():void
{
player = new Player();
player.defaults = {file:"video.flv"};
player.visible = false;
addChild(player);
//wait for player to be added to stage...
_player.addEventListener(Event.ADDED_TO_STAGE, initMyResizer);
}

private function initMyResizer(e:Event):void
{
//clean up
_player.removeEventListener(Event.ADDED_TO_STAGE, initMyResizer);

//register custom resizer to keep size on stage resize
_player.view.addViewListener(ViewEvent.RESIZE, keepMySize);
//resize it
_player.view.dispatchEvent(new ViewEvent(ViewEvent.RESIZE,{width:pWidth, height:pHeight}));
_player.visible = true;
}

private function keepMySize(e:ViewEvent):void
{
if((e.data.width != pWidth) || (e.data.height != pHeight))
{
//resize it again
player.view.dispatchEvent(new ViewEvent(ViewEvent.RESIZE,{width:pWidth, height:pHeight}));
}
}

}
}



anyone a more elegant way?

tnx!
grx

Aug. 21, 2008JeroenW

Nada, thanks for the great insights! I'll take a look at those. Expect the added_to_stage to be in the default player. I believe the absense of Player.player has already been fixed in the 4.1...

An elegant solution for not-autoscaling when in larger apps is indeed on the todo list...

Aug. 22, 2008andyo

I too would like to make very small changes and recompile the ActionScript files (actually, just the yt.as file). I've got the latest source from Subversion, and I downloaded the free Flex3 SDK. I was hoping that I could just run a simple compile command (w/o having any builder or project set up). But, without any changes I get:


/Users/andyo/jeroenwijering_as3> mxmlc yt.as
Loading configuration file /Users/andyo/flex3sdk/frameworks/flex-config.xml
/Users/andyo/jeroenwijering_as3/yt.as: Error: A file found in a source-path must have an externally visible definition. If a definition in the file is meant to be externally visible, please put the definition in a package.


I'm a super n00b at AS. I've read elsewhere that I either need an MXML file describing the stage OR other AS doing the same. I can get around the above error by adding "package { }" around the contents of yt.as, but that's just leads to more OO-oriented errors. Sounds like the AS files have to be classes with the compiler/setup I'm trying to use.

Am I missing something from the source repository, or are the AS files valid for an earlier or different compiler/setup?

Aug. 28, 2008HilaryB

@JeroenW

I don't see the adjustments mentioned in the current version in the repository, but the todo list says they are done?

Nov. 01, 2009RA

nada
Thanks!!!

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.