Mar 1, 2011 6:08 AM
Plugin Loads Twice
-
Like (0)
I am using the StrobeMediaPlayer (SMP) with a custom developed plugin that loads a SerialElement. SMP loads and plays the media, however the playback is choppy. When running the app under Firefox/Firebug it shows two GET requests for the plugin swf. Do I need to do anything different to prevent the plugin from loading more than once?
Following is my truncated PluginInfo code:
package com.myurl
{
import com.adobe.serialization.json.JSON;
import com.myurl.utils.MediaPlayerLoader;
import flash.external.ExternalInterface;
import org.osmf.elements.SerialElement;
import org.osmf.elements.VideoElement;
import org.osmf.events.LoadEvent;
import org.osmf.events.MediaElementEvent;
import org.osmf.events.TimeEvent;
import org.osmf.examples.seeking.PreloadingLoadTrait;
import org.osmf.examples.seeking.PreloadingProxyElement;
import org.osmf.media.MediaElement;
import org.osmf.media.MediaFactory;
import org.osmf.media.MediaFactoryItem;
import org.osmf.media.MediaFactoryItemType;
import org.osmf.media.MediaPlayer;
import org.osmf.media.MediaResourceBase;
import org.osmf.media.PluginInfo;
import org.osmf.net.NetLoader;
import org.osmf.net.StreamingURLResource;
public class PlayONPluginInfo extends PluginInfo
{
static public const NS_URL:String = "http://www.myurl.com";
private var trimid:String;
private var trimstate:Boolean;
public function PlayONPluginInfo()
{
var items:Vector.<MediaFactoryItem> = new Vector.<MediaFactoryItem>();
var item:MediaFactoryItem = new MediaFactoryItem
("com.URL.MyPlugin"
, canHandleResourceFunction
, mediaElementCreationFunction
, MediaFactoryItemType.STANDARD
);
items.push(item);
super(items, creationNotificationFunction);
}
override public function initializePlugin( resource:MediaResourceBase ):void
{
// Externalize Flash Vars
var meta:Object = resource.getMetadataValue( NS_URL );
trimid = meta.trimid;
trimstate = meta.trimstate;
}
private function creationNotificationFunction(media:MediaElement):void
{
}
private function canHandleResourceFunction(resource:MediaResourceBase):Boolean
{
var result:Boolean = true;
return result;
}
private function mediaElementCreationFunction():MediaElement
{
var arr:Array = getPlaylist();
var se:MediaElement = new MediaElement();
se = setupPlaylist(arr);
return se;
}
private function getPlaylist():Array
{
// Setup media array from JSON data
...blah, blah, blah...
return arr;
}
private function setupPlaylist(mediaList:Array):MediaElement
{
// Setup serial element loop
...blah, blah, blah...
return se;
}
}
}
Plugin Loading Changes
We’ve made some changes to how dynamic plugins are loaded which may impact existing plugin developers (details in the following paragraph).
Dynamic plugins are now loaded twice. On the first load, they’re placed into a separate application domain in order to validate versioning. On the second load (which should pull the plugin from the cache, negating any additional network request), they’re placed into a child of the current application domain, so that class types are merged. Note that this means that a plugin will be initialized twice. For this reason, it’s recommended that any initialization logic be placed in the overridden PluginInfo.initializePlugin method, which is only invoked on the second load.
So it appears that OSMF is doing what it is designed to do.
Copyright © 2011 Adobe Systems Incorporated. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).