Catch flashvars in custom plugin for OSMF

183 Views Asked by At

I'm creating a custom plugin for OSMF, and trying to set it to work in Strobe Media Player set up example: http://projects.stanislavstankov.com/nsa/index2.html

var parameters = {
                src: "nsa",
                autoPlay: "false",
                verbose: true,
                controlBarAutoHide: "false",
                controlBarPosition: "bottom",
                plugin_nsaPlugin: "nsaPlugin.swf", 
                nsaPlugin_streamType: "vod",
                nsaPlugin_streamName: "vod",
                nsaPlugin_mediaID: "nsa-zGAet1-e1",
                nsaPlugin_deliveryType: "rtmp"
};

I want to be able to get them but I cannot find any documentation how. I try to catch them as:

stage.loaderInfo.parameters

but stage returns null. Can someone help me?

2

There are 2 best solutions below

3
On

You can try to add a listener for the AddedToStage-Event inside flash:

addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);

private function onAddedToStage(e:Event):void {
// stage != null from now on ...
}

make sure you add the clip with this listener to the displaylist, .. using addChild()

0
On

There are some vars that you might find difficult to get like autoPlay. You are better off sending these vars to your plugin like this:

var parameters = {
                src: "nsa",
                autoPlay: "false",
                verbose: true,
                plugin_nsaPlugin: "nsaPlugin.swf", 
                nsaPlugin_autoPlay: "false",
};

Your plugin needs to extend the PluginInfo class if you want to be able to read out the variables that you send to your plugin. You read them out from the MediaResource that gets sent to the initializePlugin method upon intialization of your plugin. Here is an example.