Is it possible to compile the plugins directly into the player ?

Is it possible to compile the plugins directly into the player ?

Hi there,
I am also trying to compile custom plugins directly into the player but having some trouble. I'm calling sploader.addPlugin and my plugins are being loaded, flashvars get set and passed, but my plugins are not getting displayed, the code in the plugin seems to work however.
what do i need to do to get my plugins to display.
thank you guys for this really cool player

Hi Will,
Hard to say.
Assuming that you're adding them in Player.as, my best guess is that you're not setting visible = true in your plugin.

I have the same problem, when I compile the plugin as swf and add it in the html it shows up , but when I add the .as file in the plug in folder and load it in play.as file by using the sploader function, it loads and sends the variables through http but it does not show anything on the display.

Rob - you'll need to place the SWF in the same folder as the player, and add the filename to the flashvars, vis-a-vis
plugins=viral,hd,myplugin

I was having the same problem. I was trying to compile the QualityMonitor into the player. I could tell that everything was working, but it wasn't showing up. visible was already set to true, and all the sub-widgets had their visible set to true too. Finally, I figured out that in Player.as, I had to pass "true" as a third argument:
sploader.addPlugin(new QualityMonitor(),'qualitymonitor', true);

I am trying to call the plugin's from the source as well instead of through the embed code. But I am getting conflicting file structures:
ok.. so Ive downloaded the latest source files, and I can compile the player using those files (has the build directory). But these files do not include an SPLoader.as file.
I also have the licensed download source files, and these do include the SPLoader.as file. BUT I do not know how to compile this set as there are no build files. I am using the ant/flex sdk method and at the moment do not have any other means. So I can not just publish files like some of you have
this is all for JW 5.x.. Does the latest release not use the SPLoader methods anymore? Maybe I just try to reverse engineer the build files I have and try them out on the licensed version?
Or am I completely missing something?

doohic - Go to - src\com\longtailvideo\jwplayer\utils\Configger.as
On line 26 it looks like this:
private var _config:Object = {};
Make it like this to load a plugin in:
private var _config:Object = {plugins : "viral-2"};
For HD, it would be hd-1, however with the HD plugin you need a hd.file flashvar for each of your videos, because it is essentially a file swapper.
Hope this helps!

Thanks, I'll give it a shot, once I get that step over, I'll be attempting to change the source of HD plugin or build something else that can take the original file and manipulate the url for swapping.
So if my original is http://myfileserver/video.flv I want to dynamically swap/call http://myfileserver/video.flv.hd and my file server will figure out the HD version to host for that url.
ok.. on to try that out.. I'll report back

Np, and that is a very cool idea for a modification to make :)

ok, that works, my next obvious concerns are that I need it to look at my local plugin, so I'll try hosting the HD.swf locally, perhaps change the name to see if It still loads.

You will have to put in the full URL to where you are loading the plugin from, to host it locally, I believe.

right right.. which kinda sucks.. but I'll try it. I was hoping for more of a solution like described here:
http://www.longtailvideo.com/support/forum/Plugins/19560/Loading-Local-Plugins-for-Dummies
Where he talks about changing the "basdir" inside of SPLoader.as, but as we know, right now im working with out SPLoader.. which is a little confusing still... but I digress..

Those instructions were for the old version of the player (V4), which you can download from here - http://developer.longtailvideo.com/trac/browser/trunk/as3 (grab the zip at the bottom of the page). The new player is a complete re-write and does things differently.

full URL works for including my local plugin, now on to customizing the HD plugin.
Using a local/relative path would be more optimal as there are differences for me between dev and live environments. So in order to keep the two separate using full URL's are going to be a pita.
In response to your last post.. I thought possibly as much, but I recently purchased the licensed version of 5.1 and the SPLoader file is still there, so that threw me off.. is that there strictly for v4 support? Which I understand v4 support will go completely away in the future.
Im out for the day. Hope to be customizing the HD plugin in the AM. Thanks for your help.. This stuff has been the hardest project ive been on in awhile.

mediaplayer-licensed\com\jeroenwijering\player\SPLoader.as
let me go double check I downloaded the correct licensed version.. pretty sure I did..
I got all of my stuff working, now I just need to figure out how to recompile the player to get rid of the longtail logo, I have the licensed version, but I am compiling r911

ehh.. idk what happened.. working with to many folders/source for this JW player.. I must have copied and paste old stuff into the folder cause I went and got the licensed version again and I see its pretty barebones.. 6 files to be exact..
back to seeing how I can get rid of the logo.. I think I saw it somewhere here in the forums

oh yeah.. and of course, I am compiling the JW Player from the r911 and I can not adjust any javascript or embed code to make the logo go away. So I'll be looking for a way to adjust the logo.as file, perhaps enter my license number somewhere to make it get jiggie..

doohic, please send an email to support [at] longtailvideo [dot] com, about this, thanks.

thanks for the help
Next question, can I do the following (like above in Configger.as)?
private var _config:Object = {config : "http://website/jwplayer/config.xml"};
and inside the config xml I'll be attempting to set up whatever plugins my heart desires.

so far no luck.. if I put it in the embed code / flashvars, it works, but using what I asked above is not producing any results. My xml config is very basic at the moment for testing purposes.
<config>
<controlbar>none</controlbar>
</config>
edit:
yeah, checked and re-checked, def not working at this point.. maybe I'll try relative paths, if thats not it I'd have to assume I need to change the location of the declaration

If you show me where you are running this, that would help :)

unfortunately right now its private access on a development server. Some background is that I have been successfully compiling the player (currently working with r911 source code/build files) and successfully compiled the player with the following adjustment to Configger.as:
private var _config:Object = {plugins : "http://website/jwplayer/hd-custom.swf"};
Also successfully edited and compiled my own slightly customized HD plugin.
I have now built "config.xml" which is very basic, just as listed above. I changed the same line in Configger.as to:
private var _config:Object = {config : "http://website/jwplayer/config2.xml"};
recompiled, cleared cache, etc, etc, loaded and (in my basic example) still seeing the controlbar.
If I simply add config=url to the flashvars embed code it works like a charm, but not the desired implementation.
I think in short that I'm using the wrong place to 'plugin' the call for the config xml. On Configger.as around line 48, it appears to me that it looks at:
RootReference.root.loaderInfo.parameters['config']
for the file, I think the way I have added it in the _config:Object is the wrong location. I do not claim that I know what I am doing at all.. haha.. Let me know if there is any other info or files I can make available that will help further.

Hmm, I don't know why that wouldn't work, that should work just fine. If you could put it somewhere maybe it would help me debug more :)

I'll see what I can do about making it public, and I'll send you the zip of what I am working with.
I also started to think.. maybe there is an issue with using "config" in that location, I know config is a variable/object used throughout the code.

Yes, there might be an issue with that. Try to put it somewhere so we can debug the output though.

quick update, I played around with a lot of different things today. The only solution I came up with was to update:
public function get xmlConfig():String {
return RootReference.root.loaderInfo.parameters['config'];
}
to
public function get xmlConfig():String {
return "http://mysite/jwplayer/config.xml";
}
Now I am attempting to find the player source URL so that I can dynamically build that URL (for sake of dev/live environments). So I assume somewhere there is a player.srcurl which would be: http://mysite/jwplayer/player.swf or http://dev.mysite/jwplayer/player.swf depending on my environment. (Basically pull the src attribute from the embed code)

Hi!
And what about jw player 5?
I need to compile my .swf plugin into the player. (so result will be single player.swf)
How to do it?
Thank you!


Ethan, there is no info about compiling my plugin INTO the player on page you provided.
Please read again:
1) I build some plugin, let it be Hd.swf, using instructions right from page you gave me.
2) I build player.swf from sources, BUT I NEED TO COMPILE HD.SWF DIRECTLY INTO PLAYER
3) so, in html code I DO NOT write "plugins=hd.swf", because it is already COMPILED INTO PLAYER.
How to do it (2-3)?
Thank you..

@shmroma:
I posted this earlier in the thread.
In the source - go to - src\com\longtailvideo\jwplayer\utils\Configger.as
On line 26 it looks like this:
private var _config:Object = {};
Make it like this to load a plugin in:
private var _config:Object = {plugins : "http://www.yoursite.com/your_plugin.swf"};

Ethan, it is not what I want.
I need only one swf.
It should be named player.swf.
No separate swf for plugin.
plugin is in player.swf.
Please read it carefully, THERE SHOULD BE NO your_plugin.swf

Hi shmroma,
This would require some non-trivial modifications. The easiest way would be to add another function like the loadPluginsComplete function of PlayerSetup, perhaps called loadBuiltInPlugins, which would be called from loadPlugins.
Rather than using the plugins from PluginLoader.plugins, simply create your own array, instantiate the plugins (properly referenced from your source path), add them to the new array, and iterate over them using the logic from loadPluginsComplete.
Best,
Zach

I find myself wanting to do the same thing, has anyone had success making the changes needed to do this?

This how I done it. Compile a custom player with plugin.
package nu.pascal
{
import com.longtailvideo.jwplayer.events.PlayerEvent;
import com.longtailvideo.jwplayer.model.PlayerConfig;
import com.longtailvideo.jwplayer.player.JavascriptAPI;
import com.longtailvideo.jwplayer.player.JavascriptCompatibilityAPI;
import com.longtailvideo.jwplayer.player.Player;
import com.longtailvideo.jwplayer.plugins.PluginConfig;
public class MediaPlayer extends Player {
public function MediaPlayer() { }
override protected function playerReady(evt:PlayerEvent):void {
// Only handle JWPLAYER_READY once
controller.removeEventListener(PlayerEvent.JWPLAYER_READY, this.playerReady);
//My plugin
var plugin:MediaPlayerPlugin = new MediaPlayerPlugin();
view.addPlugin(plugin.id, plugin);
/**
* If I need any flashvars in the plugin I get them my self from the playerconfig object
*/
var pluginConf:PluginConfig = new PluginConfig(plugin.id);
pluginConf["my_options"] = config["my_options"];
//Init the plugin
plug.initPlugin(this, pluginConf);
// Initialize Javascript interface
var jsAPI:JavascriptAPI = new JavascriptCompatibilityAPI(this);
// Forward all MVC events
model.addGlobalListener(forward);
view.addGlobalListener(forward);
controller.addGlobalListener(forward);
forward(evt);
}
}
}
Hi Lucky,
This is no problem - totally possible.
In fact, the player compiles in several plugins by default. All you need to do is add the following line:
sploader.addPlugin(new MyPlugin(),'myplugin');
to the addPlugins function of Player.as.
Check out http://developer.longtailvideo.com/trac/browser/trunk/as3/com/jeroenwijering/player/Player.as#L158.