mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 17:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,99 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import org.osmf.elements.AudioElement;
|
||||
import org.osmf.elements.F4MElement;
|
||||
import org.osmf.elements.F4MLoader;
|
||||
import org.osmf.elements.ImageElement;
|
||||
import org.osmf.elements.ImageLoader;
|
||||
import org.osmf.elements.SWFElement;
|
||||
import org.osmf.elements.SWFLoader;
|
||||
import org.osmf.elements.SoundLoader;
|
||||
import org.osmf.elements.VideoElement;
|
||||
import org.osmf.net.MulticastNetLoader;
|
||||
import org.osmf.net.NetLoader;
|
||||
import org.osmf.net.dvr.DVRCastNetLoader;
|
||||
import org.osmf.net.httpstreaming.HTTPStreamingNetLoader;
|
||||
import org.osmf.net.rtmpstreaming.RTMPDynamicStreamingNetLoader;
|
||||
|
||||
public class DefaultMediaFactory extends MediaFactory
|
||||
{
|
||||
|
||||
private var rtmpStreamingNetLoader:RTMPDynamicStreamingNetLoader;
|
||||
|
||||
private var f4mLoader:F4MLoader;
|
||||
|
||||
private var dvrCastLoader:DVRCastNetLoader;
|
||||
|
||||
private var netLoader:NetLoader;
|
||||
|
||||
private var imageLoader:ImageLoader;
|
||||
|
||||
private var swfLoader:SWFLoader;
|
||||
|
||||
private var soundLoader:SoundLoader;
|
||||
|
||||
private var httpStreamingNetLoader:HTTPStreamingNetLoader;
|
||||
|
||||
private var multicastLoader:MulticastNetLoader;
|
||||
|
||||
public function DefaultMediaFactory()
|
||||
{
|
||||
super();
|
||||
this.init();
|
||||
}
|
||||
|
||||
private function init() : void
|
||||
{
|
||||
this.f4mLoader = new F4MLoader(this);
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.f4m",this.f4mLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new F4MElement(null,f4mLoader);
|
||||
}));
|
||||
this.dvrCastLoader = new DVRCastNetLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.video.dvr.dvrcast",this.dvrCastLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new VideoElement(null,dvrCastLoader);
|
||||
}));
|
||||
this.httpStreamingNetLoader = new HTTPStreamingNetLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.video.httpstreaming",this.httpStreamingNetLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new VideoElement(null,httpStreamingNetLoader);
|
||||
}));
|
||||
this.multicastLoader = new MulticastNetLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.video.rtmfp.multicast",this.multicastLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new VideoElement(null,multicastLoader);
|
||||
}));
|
||||
this.rtmpStreamingNetLoader = new RTMPDynamicStreamingNetLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.video.rtmpdynamicStreaming",this.rtmpStreamingNetLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new VideoElement(null,rtmpStreamingNetLoader);
|
||||
}));
|
||||
this.netLoader = new NetLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.video",this.netLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new VideoElement(null,netLoader);
|
||||
}));
|
||||
this.soundLoader = new SoundLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.audio",this.soundLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new AudioElement(null,soundLoader);
|
||||
}));
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.audio.streaming",this.netLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new AudioElement(null,netLoader);
|
||||
}));
|
||||
this.imageLoader = new ImageLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.image",this.imageLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new ImageElement(null,imageLoader);
|
||||
}));
|
||||
this.swfLoader = new SWFLoader();
|
||||
addItem(new MediaFactoryItem("org.osmf.elements.swf",this.swfLoader.canHandleResource,function():MediaElement
|
||||
{
|
||||
return new SWFElement(null,swfLoader);
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import org.osmf.traits.MediaTraitBase;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class DefaultTraitResolver extends MediaTraitResolver
|
||||
{
|
||||
|
||||
private var defaultTrait:MediaTraitBase;
|
||||
|
||||
private var trait:MediaTraitBase;
|
||||
|
||||
public function DefaultTraitResolver(param1:String, param2:MediaTraitBase)
|
||||
{
|
||||
super(param1);
|
||||
if(param2 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(param2.traitType != param1)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
this.defaultTrait = param2;
|
||||
setResolvedTrait(param2);
|
||||
}
|
||||
|
||||
override protected function processAddTrait(param1:MediaTraitBase) : void
|
||||
{
|
||||
if(this.trait == null)
|
||||
{
|
||||
setResolvedTrait(this.trait = param1);
|
||||
}
|
||||
}
|
||||
|
||||
override protected function processRemoveTrait(param1:MediaTraitBase) : MediaTraitBase
|
||||
{
|
||||
var _loc2_:MediaTraitBase = null;
|
||||
if(Boolean(param1) && param1 == this.trait)
|
||||
{
|
||||
_loc2_ = this.trait;
|
||||
this.trait = null;
|
||||
setResolvedTrait(this.defaultTrait);
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.traits.LoadState;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
import org.osmf.traits.MediaTraitType;
|
||||
|
||||
public class LoadableElementBase extends MediaElement
|
||||
{
|
||||
|
||||
private var _loader:LoaderBase;
|
||||
|
||||
public function LoadableElementBase(param1:MediaResourceBase = null, param2:LoaderBase = null)
|
||||
{
|
||||
super();
|
||||
this._loader = param2;
|
||||
this.resource = param1;
|
||||
}
|
||||
|
||||
override public function set resource(param1:MediaResourceBase) : void
|
||||
{
|
||||
super.resource = param1;
|
||||
this.updateLoadTrait();
|
||||
}
|
||||
|
||||
final protected function get loader() : LoaderBase
|
||||
{
|
||||
return this._loader;
|
||||
}
|
||||
|
||||
final protected function set loader(param1:LoaderBase) : void
|
||||
{
|
||||
this._loader = param1;
|
||||
}
|
||||
|
||||
protected function createLoadTrait(param1:MediaResourceBase, param2:LoaderBase) : LoadTrait
|
||||
{
|
||||
return new LoadTrait(this._loader,param1);
|
||||
}
|
||||
|
||||
protected function processLoadingState() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processReadyState() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processUnloadingState() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function getLoaderForResource(param1:MediaResourceBase, param2:Vector.<LoaderBase>) : LoaderBase
|
||||
{
|
||||
var _loc4_:Boolean = false;
|
||||
var _loc5_:LoaderBase = null;
|
||||
var _loc3_:LoaderBase = this.loader;
|
||||
if(param1 != null && (this.loader == null || this.loader.canHandleResource(param1) == false))
|
||||
{
|
||||
_loc4_ = false;
|
||||
for each(_loc5_ in param2)
|
||||
{
|
||||
if(this.loader == null || this.loader != _loc5_)
|
||||
{
|
||||
if(_loc5_.canHandleResource(param1))
|
||||
{
|
||||
_loc3_ = _loc5_;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc3_ == null && param2 != null)
|
||||
{
|
||||
_loc3_ = param2[param2.length - 1];
|
||||
}
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function onLoadStateChange(param1:LoadEvent) : void
|
||||
{
|
||||
if(param1.loadState == LoadState.LOADING)
|
||||
{
|
||||
this.processLoadingState();
|
||||
}
|
||||
else if(param1.loadState == LoadState.READY)
|
||||
{
|
||||
this.processReadyState();
|
||||
}
|
||||
else if(param1.loadState == LoadState.UNLOADING)
|
||||
{
|
||||
this.processUnloadingState();
|
||||
}
|
||||
}
|
||||
|
||||
private function updateLoadTrait() : void
|
||||
{
|
||||
var _loc1_:LoadTrait = getTrait(MediaTraitType.LOAD) as LoadTrait;
|
||||
if(_loc1_ != null)
|
||||
{
|
||||
if(_loc1_.loadState == LoadState.READY)
|
||||
{
|
||||
_loc1_.unload();
|
||||
}
|
||||
_loc1_.removeEventListener(LoadEvent.LOAD_STATE_CHANGE,this.onLoadStateChange);
|
||||
removeTrait(MediaTraitType.LOAD);
|
||||
}
|
||||
if(this.loader != null)
|
||||
{
|
||||
_loc1_ = this.createLoadTrait(resource,this.loader);
|
||||
_loc1_.addEventListener(LoadEvent.LOAD_STATE_CHANGE,this.onLoadStateChange,false,10);
|
||||
addTrait(MediaTraitType.LOAD,_loc1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.containers.IMediaContainer;
|
||||
import org.osmf.events.ContainerChangeEvent;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.metadata.Metadata;
|
||||
import org.osmf.traits.MediaTraitBase;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class MediaElement extends EventDispatcher
|
||||
{
|
||||
|
||||
private var traits:Dictionary = new Dictionary();
|
||||
|
||||
private var traitResolvers:Dictionary = new Dictionary();
|
||||
|
||||
private var unresolvedTraits:Dictionary = new Dictionary();
|
||||
|
||||
private var _traitTypes:Vector.<String> = new Vector.<String>();
|
||||
|
||||
private var _resource:MediaResourceBase;
|
||||
|
||||
private var _metadata:Metadata;
|
||||
|
||||
private var _container:IMediaContainer;
|
||||
|
||||
public function MediaElement()
|
||||
{
|
||||
super();
|
||||
this._metadata = this.createMetadata();
|
||||
this._metadata.addEventListener(MetadataEvent.VALUE_ADD,this.onMetadataValueAdd);
|
||||
this._metadata.addEventListener(MetadataEvent.VALUE_REMOVE,this.onMetadataValueRemove);
|
||||
this._metadata.addEventListener(MetadataEvent.VALUE_CHANGE,this.onMetadataValueChange);
|
||||
this.setupTraitResolvers();
|
||||
this.setupTraits();
|
||||
addEventListener(ContainerChangeEvent.CONTAINER_CHANGE,this.onContainerChange,false,Number.MAX_VALUE);
|
||||
}
|
||||
|
||||
public function get traitTypes() : Vector.<String>
|
||||
{
|
||||
return this._traitTypes.concat();
|
||||
}
|
||||
|
||||
public function hasTrait(param1:String) : Boolean
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
return this.traits[param1] != null;
|
||||
}
|
||||
|
||||
public function getTrait(param1:String) : MediaTraitBase
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
return this.traits[param1];
|
||||
}
|
||||
|
||||
public function get resource() : MediaResourceBase
|
||||
{
|
||||
return this._resource;
|
||||
}
|
||||
|
||||
public function set resource(param1:MediaResourceBase) : void
|
||||
{
|
||||
this._resource = param1;
|
||||
}
|
||||
|
||||
public function get container() : IMediaContainer
|
||||
{
|
||||
return this._container;
|
||||
}
|
||||
|
||||
public function addMetadata(param1:String, param2:Metadata) : void
|
||||
{
|
||||
if(param1 == null || param2 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
this.metadata.addValue(param1,param2);
|
||||
}
|
||||
|
||||
public function removeMetadata(param1:String) : Metadata
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
return this.metadata.removeValue(param1) as Metadata;
|
||||
}
|
||||
|
||||
public function getMetadata(param1:String) : Metadata
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
return this.metadata.getValue(param1) as Metadata;
|
||||
}
|
||||
|
||||
public function get metadataNamespaceURLs() : Vector.<String>
|
||||
{
|
||||
return this.metadata.keys;
|
||||
}
|
||||
|
||||
protected function createMetadata() : Metadata
|
||||
{
|
||||
return new Metadata();
|
||||
}
|
||||
|
||||
public function get metadata() : Metadata
|
||||
{
|
||||
return this._metadata;
|
||||
}
|
||||
|
||||
protected function addTrait(param1:String, param2:MediaTraitBase) : void
|
||||
{
|
||||
if(param1 == null || param2 == null || param1 != param2.traitType)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
var _loc3_:MediaTraitResolver = this.traitResolvers[param1];
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
_loc3_.addTrait(param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setLocalTrait(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
protected function removeTrait(param1:String) : MediaTraitBase
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
var _loc2_:MediaTraitBase = this.traits[param1];
|
||||
var _loc3_:MediaTraitResolver = this.traitResolvers[param1];
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
return _loc3_.removeTrait(_loc2_);
|
||||
}
|
||||
return this.setLocalTrait(param1,null);
|
||||
}
|
||||
|
||||
final protected function addTraitResolver(param1:String, param2:MediaTraitResolver) : void
|
||||
{
|
||||
var _loc3_:MediaTraitBase = null;
|
||||
if(param2 == null || param2.type != param1)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
if(this.traitResolvers[param1] == null)
|
||||
{
|
||||
this.unresolvedTraits[param1] = this.traits[param1];
|
||||
this.traitResolvers[param1] = param2;
|
||||
_loc3_ = this.traits[param1];
|
||||
if(_loc3_)
|
||||
{
|
||||
param2.addTrait(_loc3_);
|
||||
}
|
||||
this.processResolvedTraitChange(param1,param2.resolvedTrait);
|
||||
param2.addEventListener(Event.CHANGE,this.onTraitResolverChange);
|
||||
return;
|
||||
}
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.TRAIT_RESOLVER_ALREADY_ADDED));
|
||||
}
|
||||
|
||||
final protected function removeTraitResolver(param1:String) : MediaTraitResolver
|
||||
{
|
||||
if(param1 == null || this.traitResolvers[param1] == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
var _loc2_:MediaTraitResolver = this.traitResolvers[param1];
|
||||
_loc2_.removeEventListener(Event.CHANGE,this.onTraitResolverChange);
|
||||
delete this.traitResolvers[param1];
|
||||
var _loc3_:MediaTraitBase = this.unresolvedTraits[param1];
|
||||
if(_loc3_ != this.traits[param1])
|
||||
{
|
||||
this.setLocalTrait(param1,_loc3_);
|
||||
}
|
||||
delete this.unresolvedTraits[param1];
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
final protected function getTraitResolver(param1:String) : MediaTraitResolver
|
||||
{
|
||||
return this.traitResolvers[param1];
|
||||
}
|
||||
|
||||
protected function setupTraitResolvers() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function setupTraits() : void
|
||||
{
|
||||
}
|
||||
|
||||
private function onMediaError(param1:MediaErrorEvent) : void
|
||||
{
|
||||
dispatchEvent(param1.clone());
|
||||
}
|
||||
|
||||
private function setLocalTrait(param1:String, param2:MediaTraitBase) : MediaTraitBase
|
||||
{
|
||||
var _loc3_:MediaTraitBase = this.traits[param1];
|
||||
if(param2 == null)
|
||||
{
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
_loc3_.removeEventListener(MediaErrorEvent.MEDIA_ERROR,this.onMediaError);
|
||||
_loc3_.dispose();
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.TRAIT_REMOVE,false,false,param1));
|
||||
this._traitTypes.splice(this._traitTypes.indexOf(param1),1);
|
||||
delete this.traits[param1];
|
||||
}
|
||||
}
|
||||
else if(_loc3_ == null)
|
||||
{
|
||||
this.traits[param1] = _loc3_ = param2;
|
||||
this._traitTypes.push(param1);
|
||||
_loc3_.addEventListener(MediaErrorEvent.MEDIA_ERROR,this.onMediaError);
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.TRAIT_ADD,false,false,param1));
|
||||
}
|
||||
else if(_loc3_ != param2)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.TRAIT_INSTANCE_ALREADY_ADDED));
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function onTraitResolverChange(param1:Event) : void
|
||||
{
|
||||
var _loc2_:MediaTraitResolver = param1.target as MediaTraitResolver;
|
||||
this.processResolvedTraitChange(_loc2_.type,_loc2_.resolvedTrait);
|
||||
}
|
||||
|
||||
private function processResolvedTraitChange(param1:String, param2:MediaTraitBase) : void
|
||||
{
|
||||
if(param2 != this.traits[param1])
|
||||
{
|
||||
this.setLocalTrait(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
private function onContainerChange(param1:ContainerChangeEvent) : void
|
||||
{
|
||||
if(this._container == param1.oldContainer && this._container != param1.newContainer)
|
||||
{
|
||||
this._container = param1.newContainer;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMetadataValueAdd(param1:MetadataEvent) : void
|
||||
{
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.METADATA_ADD,false,false,null,param1.key,param1.value as Metadata));
|
||||
}
|
||||
|
||||
private function onMetadataValueChange(param1:MetadataEvent) : void
|
||||
{
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.METADATA_REMOVE,false,false,null,param1.key,param1.oldValue as Metadata));
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.METADATA_ADD,false,false,null,param1.key,param1.value as Metadata));
|
||||
}
|
||||
|
||||
private function onMetadataValueRemove(param1:MetadataEvent) : void
|
||||
{
|
||||
dispatchEvent(new MediaElementEvent(MediaElementEvent.METADATA_REMOVE,false,false,null,param1.key,param1.value as Metadata));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.elements.ProxyElement;
|
||||
import org.osmf.events.MediaFactoryEvent;
|
||||
import org.osmf.events.PluginManagerEvent;
|
||||
import org.osmf.media.pluginClasses.PluginManager;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class MediaFactory extends EventDispatcher
|
||||
{
|
||||
|
||||
private var pluginManager:PluginManager;
|
||||
|
||||
private var allItems:Dictionary;
|
||||
|
||||
public function MediaFactory()
|
||||
{
|
||||
super();
|
||||
this.allItems = new Dictionary();
|
||||
}
|
||||
|
||||
private static function getItemsByResource(param1:MediaResourceBase, param2:Vector.<MediaFactoryItem>) : Vector.<MediaFactoryItem>
|
||||
{
|
||||
var _loc4_:MediaFactoryItem = null;
|
||||
var _loc3_:Vector.<MediaFactoryItem> = new Vector.<MediaFactoryItem>();
|
||||
for each(_loc4_ in param2)
|
||||
{
|
||||
if(_loc4_.canHandleResourceFunction(param1))
|
||||
{
|
||||
_loc3_.push(_loc4_);
|
||||
}
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private static function getIndexOfItem(param1:String, param2:Vector.<MediaFactoryItem>) : int
|
||||
{
|
||||
var _loc4_:MediaFactoryItem = null;
|
||||
var _loc3_:int = 0;
|
||||
while(_loc3_ < param2.length)
|
||||
{
|
||||
_loc4_ = param2[_loc3_] as MediaFactoryItem;
|
||||
if(_loc4_.id == param1)
|
||||
{
|
||||
return _loc3_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function addItem(param1:MediaFactoryItem) : void
|
||||
{
|
||||
if(param1 == null || param1.id == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
var _loc2_:Vector.<MediaFactoryItem> = this.findOrCreateItems(param1.type);
|
||||
var _loc3_:int = getIndexOfItem(param1.id,_loc2_);
|
||||
if(_loc3_ != -1)
|
||||
{
|
||||
_loc2_[_loc3_] = param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.push(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeItem(param1:MediaFactoryItem) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
if(param1 == null || param1.id == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
var _loc2_:Vector.<MediaFactoryItem> = this.allItems[param1.type];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
_loc3_ = _loc2_.indexOf(param1);
|
||||
if(_loc3_ != -1)
|
||||
{
|
||||
_loc2_.splice(_loc3_,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get numItems() : int
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:Vector.<MediaFactoryItem> = null;
|
||||
var _loc1_:int = 0;
|
||||
for each(_loc2_ in MediaFactoryItemType.ALL_TYPES)
|
||||
{
|
||||
_loc3_ = this.allItems[_loc2_];
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
_loc1_ += _loc3_.length;
|
||||
}
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function getItemAt(param1:int) : MediaFactoryItem
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:Vector.<MediaFactoryItem> = null;
|
||||
var _loc2_:MediaFactoryItem = null;
|
||||
if(param1 >= 0)
|
||||
{
|
||||
for each(_loc3_ in MediaFactoryItemType.ALL_TYPES)
|
||||
{
|
||||
_loc4_ = this.allItems[_loc3_];
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
if(param1 < _loc4_.length)
|
||||
{
|
||||
_loc2_ = _loc4_[param1];
|
||||
break;
|
||||
}
|
||||
param1 -= _loc4_.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function getItemById(param1:String) : MediaFactoryItem
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc4_:Vector.<MediaFactoryItem> = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:MediaFactoryItem = null;
|
||||
for each(_loc3_ in MediaFactoryItemType.ALL_TYPES)
|
||||
{
|
||||
_loc4_ = this.allItems[_loc3_];
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
_loc5_ = getIndexOfItem(param1,_loc4_);
|
||||
if(_loc5_ != -1)
|
||||
{
|
||||
_loc2_ = _loc4_[_loc5_];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function loadPlugin(param1:MediaResourceBase) : void
|
||||
{
|
||||
this.createPluginManager();
|
||||
this.pluginManager.loadPlugin(param1);
|
||||
}
|
||||
|
||||
public function createMediaElement(param1:MediaResourceBase) : MediaElement
|
||||
{
|
||||
var _loc3_:MediaElement = null;
|
||||
this.createPluginManager();
|
||||
var _loc2_:MediaElement = this.createMediaElementByResource(param1,MediaFactoryItemType.STANDARD);
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
_loc3_ = this.createMediaElementByResource(_loc2_.resource,MediaFactoryItemType.PROXY,_loc2_);
|
||||
_loc2_ = _loc3_ != null ? _loc3_ : _loc2_;
|
||||
dispatchEvent(new MediaFactoryEvent(MediaFactoryEvent.MEDIA_ELEMENT_CREATE,false,false,null,_loc2_));
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
protected function resolveItems(param1:MediaResourceBase, param2:Vector.<MediaFactoryItem>) : MediaFactoryItem
|
||||
{
|
||||
var _loc5_:MediaFactoryItem = null;
|
||||
if(param1 == null || param2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var _loc3_:MediaFactoryItem = null;
|
||||
var _loc4_:int = 0;
|
||||
while(_loc4_ < param2.length)
|
||||
{
|
||||
_loc5_ = param2[_loc4_] as MediaFactoryItem;
|
||||
if(_loc5_.id.indexOf("org.osmf") == -1)
|
||||
{
|
||||
return _loc5_;
|
||||
}
|
||||
if(_loc3_ == null)
|
||||
{
|
||||
_loc3_ = _loc5_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function findOrCreateItems(param1:String) : Vector.<MediaFactoryItem>
|
||||
{
|
||||
if(this.allItems[param1] == null)
|
||||
{
|
||||
this.allItems[param1] = new Vector.<MediaFactoryItem>();
|
||||
}
|
||||
return this.allItems[param1] as Vector.<MediaFactoryItem>;
|
||||
}
|
||||
|
||||
private function createMediaElementByResource(param1:MediaResourceBase, param2:String, param3:MediaElement = null) : MediaElement
|
||||
{
|
||||
var _loc6_:MediaFactoryItem = null;
|
||||
var _loc7_:MediaElement = null;
|
||||
var _loc8_:* = 0;
|
||||
var _loc9_:MediaFactoryItem = null;
|
||||
var _loc10_:ProxyElement = null;
|
||||
var _loc4_:MediaElement = null;
|
||||
var _loc5_:Vector.<MediaFactoryItem> = getItemsByResource(param1,this.allItems[param2]);
|
||||
if(param2 == MediaFactoryItemType.STANDARD)
|
||||
{
|
||||
_loc6_ = this.resolveItems(param1,_loc5_) as MediaFactoryItem;
|
||||
if(_loc6_ != null)
|
||||
{
|
||||
_loc4_ = this.invokeMediaElementCreationFunction(_loc6_);
|
||||
}
|
||||
}
|
||||
else if(param2 == MediaFactoryItemType.PROXY)
|
||||
{
|
||||
_loc7_ = param3;
|
||||
_loc8_ = int(_loc5_.length);
|
||||
while(_loc8_ > 0)
|
||||
{
|
||||
_loc9_ = _loc5_[_loc8_ - 1] as MediaFactoryItem;
|
||||
_loc10_ = this.invokeMediaElementCreationFunction(_loc9_) as ProxyElement;
|
||||
if(_loc10_ != null)
|
||||
{
|
||||
_loc10_.proxiedElement = _loc7_;
|
||||
_loc7_ = _loc10_;
|
||||
}
|
||||
_loc8_--;
|
||||
}
|
||||
_loc4_ = _loc7_;
|
||||
}
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
_loc4_.resource = param1;
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
private function onPluginLoad(param1:PluginManagerEvent) : void
|
||||
{
|
||||
dispatchEvent(new MediaFactoryEvent(MediaFactoryEvent.PLUGIN_LOAD,false,false,param1.resource));
|
||||
}
|
||||
|
||||
private function onPluginLoadError(param1:PluginManagerEvent) : void
|
||||
{
|
||||
dispatchEvent(new MediaFactoryEvent(MediaFactoryEvent.PLUGIN_LOAD_ERROR,false,false,param1.resource));
|
||||
}
|
||||
|
||||
private function invokeMediaElementCreationFunction(param1:MediaFactoryItem) : MediaElement
|
||||
{
|
||||
var _loc2_:MediaElement = null;
|
||||
try
|
||||
{
|
||||
_loc2_ = param1.mediaElementCreationFunction();
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function createPluginManager() : void
|
||||
{
|
||||
if(this.pluginManager == null)
|
||||
{
|
||||
this.pluginManager = new PluginManager(this);
|
||||
this.pluginManager.addEventListener(PluginManagerEvent.PLUGIN_LOAD,this.onPluginLoad);
|
||||
this.pluginManager.addEventListener(PluginManagerEvent.PLUGIN_LOAD_ERROR,this.onPluginLoadError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class MediaFactoryItem
|
||||
{
|
||||
|
||||
private var _id:String;
|
||||
|
||||
private var _canHandleResourceFunction:Function;
|
||||
|
||||
private var _mediaElementCreationFunction:Function;
|
||||
|
||||
private var _type:String;
|
||||
|
||||
public function MediaFactoryItem(param1:String, param2:Function, param3:Function, param4:String = null)
|
||||
{
|
||||
super();
|
||||
if(param1 == null || param2 == null || param3 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
param4 ||= MediaFactoryItemType.STANDARD;
|
||||
this._id = param1;
|
||||
this._canHandleResourceFunction = param2;
|
||||
this._mediaElementCreationFunction = param3;
|
||||
this._type = param4;
|
||||
}
|
||||
|
||||
public function get id() : String
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get canHandleResourceFunction() : Function
|
||||
{
|
||||
return this._canHandleResourceFunction;
|
||||
}
|
||||
|
||||
public function get mediaElementCreationFunction() : Function
|
||||
{
|
||||
return this._mediaElementCreationFunction;
|
||||
}
|
||||
|
||||
public function get type() : String
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public class MediaFactoryItemType
|
||||
{
|
||||
|
||||
public static const STANDARD:String = "standard";
|
||||
|
||||
public static const PROXY:String = "proxy";
|
||||
|
||||
internal static const ALL_TYPES:Array = [STANDARD,PROXY];
|
||||
|
||||
public function MediaFactoryItemType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,26 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public final class MediaPlayerState
|
||||
{
|
||||
|
||||
public static const UNINITIALIZED:String = "uninitialized";
|
||||
|
||||
public static const LOADING:String = "loading";
|
||||
|
||||
public static const READY:String = "ready";
|
||||
|
||||
public static const PLAYING:String = "playing";
|
||||
|
||||
public static const PAUSED:String = "paused";
|
||||
|
||||
public static const BUFFERING:String = "buffering";
|
||||
|
||||
public static const PLAYBACK_ERROR:String = "playbackError";
|
||||
|
||||
public function MediaPlayerState()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import flash.utils.Dictionary;
|
||||
|
||||
public class MediaResourceBase
|
||||
{
|
||||
|
||||
private var _metadata:Dictionary;
|
||||
|
||||
private var _mediaType:String;
|
||||
|
||||
private var _mimeType:String;
|
||||
|
||||
public function MediaResourceBase()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get mediaType() : String
|
||||
{
|
||||
return this._mediaType;
|
||||
}
|
||||
|
||||
public function set mediaType(param1:String) : void
|
||||
{
|
||||
this._mediaType = param1;
|
||||
}
|
||||
|
||||
public function get mimeType() : String
|
||||
{
|
||||
return this._mimeType;
|
||||
}
|
||||
|
||||
public function set mimeType(param1:String) : void
|
||||
{
|
||||
this._mimeType = param1;
|
||||
}
|
||||
|
||||
public function get metadataNamespaceURLs() : Vector.<String>
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc1_:Vector.<String> = new Vector.<String>();
|
||||
if(this._metadata != null)
|
||||
{
|
||||
for(_loc2_ in this._metadata)
|
||||
{
|
||||
_loc1_.push(_loc2_);
|
||||
}
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function addMetadataValue(param1:String, param2:Object) : void
|
||||
{
|
||||
if(this._metadata == null)
|
||||
{
|
||||
this._metadata = new Dictionary();
|
||||
}
|
||||
this._metadata[param1] = param2;
|
||||
}
|
||||
|
||||
public function getMetadataValue(param1:String) : Object
|
||||
{
|
||||
if(this._metadata != null)
|
||||
{
|
||||
return this._metadata[param1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function removeMetadataValue(param1:String) : Object
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
if(this._metadata != null)
|
||||
{
|
||||
_loc2_ = this._metadata[param1];
|
||||
delete this._metadata[param1];
|
||||
return _loc2_;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import org.osmf.traits.MediaTraitBase;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
internal class MediaTraitResolver extends EventDispatcher
|
||||
{
|
||||
|
||||
private var _type:String;
|
||||
|
||||
private var _resolvedTrait:MediaTraitBase;
|
||||
|
||||
public function MediaTraitResolver(param1:String)
|
||||
{
|
||||
super();
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
this._type = param1;
|
||||
}
|
||||
|
||||
final public function get type() : String
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
final protected function setResolvedTrait(param1:MediaTraitBase) : void
|
||||
{
|
||||
if(param1 != this._resolvedTrait)
|
||||
{
|
||||
if(this._resolvedTrait)
|
||||
{
|
||||
this._resolvedTrait = null;
|
||||
dispatchEvent(new Event(Event.CHANGE));
|
||||
}
|
||||
this._resolvedTrait = param1;
|
||||
dispatchEvent(new Event(Event.CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
final public function get resolvedTrait() : MediaTraitBase
|
||||
{
|
||||
return this._resolvedTrait;
|
||||
}
|
||||
|
||||
final public function addTrait(param1:MediaTraitBase) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(param1.traitType != this.type)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
this.processAddTrait(param1);
|
||||
}
|
||||
|
||||
final public function removeTrait(param1:MediaTraitBase) : MediaTraitBase
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(param1.traitType != this.type)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
return this.processRemoveTrait(param1);
|
||||
}
|
||||
|
||||
protected function processAddTrait(param1:MediaTraitBase) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function processRemoveTrait(param1:MediaTraitBase) : MediaTraitBase
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public final class MediaType
|
||||
{
|
||||
|
||||
public static const VIDEO:String = "video";
|
||||
|
||||
public static const AUDIO:String = "audio";
|
||||
|
||||
public static const IMAGE:String = "image";
|
||||
|
||||
public static const SWF:String = "swf";
|
||||
|
||||
public function MediaType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public class MediaTypeUtil
|
||||
{
|
||||
|
||||
public static const METADATA_MATCH_FOUND:int = 0;
|
||||
|
||||
public static const METADATA_CONFLICTS_FOUND:int = 1;
|
||||
|
||||
public static const METADATA_MATCH_UNKNOWN:int = 2;
|
||||
|
||||
public function MediaTypeUtil()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function checkMetadataMatchWithResource(param1:MediaResourceBase, param2:Vector.<String>, param3:Vector.<String>) : int
|
||||
{
|
||||
var _loc4_:String = param1 ? param1.mediaType : null;
|
||||
var _loc5_:String = param1 ? param1.mimeType : null;
|
||||
return checkMetadataMatch(_loc4_,_loc5_,param2,param3);
|
||||
}
|
||||
|
||||
public static function checkMetadataMatch(param1:String, param2:String, param3:Vector.<String>, param4:Vector.<String>) : int
|
||||
{
|
||||
if(param1 != null)
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
return matchType(param1,param3) && matchType(param2,param4) ? METADATA_MATCH_FOUND : METADATA_CONFLICTS_FOUND;
|
||||
}
|
||||
return matchType(param1,param3) ? METADATA_MATCH_FOUND : METADATA_CONFLICTS_FOUND;
|
||||
}
|
||||
if(param2 != null)
|
||||
{
|
||||
return matchType(param2,param4) ? METADATA_MATCH_FOUND : METADATA_CONFLICTS_FOUND;
|
||||
}
|
||||
return METADATA_MATCH_UNKNOWN;
|
||||
}
|
||||
|
||||
private static function matchType(param1:String, param2:Vector.<String>) : Boolean
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
while(_loc3_ < param2.length)
|
||||
{
|
||||
if(param1 == param2[_loc3_])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
import org.osmf.media.pluginClasses.VersionUtils;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
import org.osmf.utils.Version;
|
||||
|
||||
public class PluginInfo
|
||||
{
|
||||
|
||||
public static const PLUGIN_MEDIAFACTORY_NAMESPACE:String = "http://www.osmf.org/plugin/mediaFactory/1.0";
|
||||
|
||||
private var _mediaFactoryItems:Vector.<MediaFactoryItem>;
|
||||
|
||||
private var _mediaElementCreationNotificationFunction:Function;
|
||||
|
||||
public function PluginInfo(param1:Vector.<MediaFactoryItem> = null, param2:Function = null)
|
||||
{
|
||||
super();
|
||||
this._mediaFactoryItems = param1 != null ? param1 : new Vector.<MediaFactoryItem>();
|
||||
this._mediaElementCreationNotificationFunction = param2;
|
||||
}
|
||||
|
||||
public function get numMediaFactoryItems() : int
|
||||
{
|
||||
return this._mediaFactoryItems.length;
|
||||
}
|
||||
|
||||
public function get frameworkVersion() : String
|
||||
{
|
||||
return Version.version;
|
||||
}
|
||||
|
||||
public function getMediaFactoryItemAt(param1:int) : MediaFactoryItem
|
||||
{
|
||||
if(param1 < 0 || param1 >= this._mediaFactoryItems.length)
|
||||
{
|
||||
throw new RangeError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
return this._mediaFactoryItems[param1] as MediaFactoryItem;
|
||||
}
|
||||
|
||||
public function isFrameworkVersionSupported(param1:String) : Boolean
|
||||
{
|
||||
if(param1 == null || param1.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var _loc2_:Object = VersionUtils.parseVersionString(param1);
|
||||
var _loc3_:Object = VersionUtils.parseVersionString(this.frameworkVersion);
|
||||
return _loc2_.major > _loc3_.major || _loc2_.major == _loc3_.major && _loc2_.minor >= _loc3_.minor;
|
||||
}
|
||||
|
||||
public function initializePlugin(param1:MediaResourceBase) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function get mediaElementCreationNotificationFunction() : Function
|
||||
{
|
||||
return this._mediaElementCreationNotificationFunction;
|
||||
}
|
||||
|
||||
final protected function get mediaFactoryItems() : Vector.<MediaFactoryItem>
|
||||
{
|
||||
return this._mediaFactoryItems;
|
||||
}
|
||||
|
||||
final protected function set mediaFactoryItems(param1:Vector.<MediaFactoryItem>) : void
|
||||
{
|
||||
this._mediaFactoryItems = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public class PluginInfoResource extends MediaResourceBase
|
||||
{
|
||||
|
||||
private var _pluginInfo:PluginInfo;
|
||||
|
||||
public function PluginInfoResource(param1:PluginInfo)
|
||||
{
|
||||
super();
|
||||
this._pluginInfo = param1;
|
||||
}
|
||||
|
||||
public function get pluginInfo() : PluginInfo
|
||||
{
|
||||
return this._pluginInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.osmf.media
|
||||
{
|
||||
public class URLResource extends MediaResourceBase
|
||||
{
|
||||
|
||||
private var _url:String;
|
||||
|
||||
public function URLResource(param1:String)
|
||||
{
|
||||
super();
|
||||
this._url = param1;
|
||||
}
|
||||
|
||||
public function get url() : String
|
||||
{
|
||||
return this._url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import org.osmf.elements.SWFLoader;
|
||||
import org.osmf.elements.loaderClasses.LoaderLoadTrait;
|
||||
import org.osmf.events.LoaderEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.media.MediaFactory;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfo;
|
||||
import org.osmf.traits.LoadState;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
|
||||
internal class DynamicPluginLoader extends PluginLoader
|
||||
{
|
||||
|
||||
private static const PLUGININFO_PROPERTY_NAME:String = "pluginInfo";
|
||||
|
||||
public function DynamicPluginLoader(param1:MediaFactory, param2:String)
|
||||
{
|
||||
super(param1,param2);
|
||||
}
|
||||
|
||||
override public function canHandleResource(param1:MediaResourceBase) : Boolean
|
||||
{
|
||||
return new SWFLoader().canHandleResource(param1);
|
||||
}
|
||||
|
||||
override protected function executeLoad(param1:LoadTrait) : void
|
||||
{
|
||||
var swfLoader:SWFLoader = null;
|
||||
var loaderLoadTrait:LoaderLoadTrait = null;
|
||||
var onSWFLoaderStateChange:Function = null;
|
||||
var onLoadError:Function = null;
|
||||
var loadTrait:LoadTrait = param1;
|
||||
onSWFLoaderStateChange = function(param1:LoaderEvent):void
|
||||
{
|
||||
var _loc2_:DisplayObject = null;
|
||||
var _loc3_:PluginInfo = null;
|
||||
if(param1.newState == LoadState.READY)
|
||||
{
|
||||
swfLoader.removeEventListener(LoaderEvent.LOAD_STATE_CHANGE,onSWFLoaderStateChange);
|
||||
loaderLoadTrait.removeEventListener(MediaErrorEvent.MEDIA_ERROR,onLoadError);
|
||||
_loc2_ = loaderLoadTrait.loader.content;
|
||||
_loc3_ = _loc2_[PLUGININFO_PROPERTY_NAME] as PluginInfo;
|
||||
loadFromPluginInfo(loadTrait,_loc3_,loaderLoadTrait.loader);
|
||||
}
|
||||
else if(param1.newState == LoadState.LOAD_ERROR)
|
||||
{
|
||||
swfLoader.removeEventListener(LoaderEvent.LOAD_STATE_CHANGE,onSWFLoaderStateChange);
|
||||
updateLoadTrait(loadTrait,param1.newState);
|
||||
}
|
||||
};
|
||||
onLoadError = function(param1:MediaErrorEvent):void
|
||||
{
|
||||
loaderLoadTrait.removeEventListener(MediaErrorEvent.MEDIA_ERROR,onLoadError);
|
||||
loadTrait.dispatchEvent(param1.clone());
|
||||
};
|
||||
updateLoadTrait(loadTrait,LoadState.LOADING);
|
||||
swfLoader = new SWFLoader(true);
|
||||
swfLoader.validateLoadedContentFunction = this.validateLoadedContent;
|
||||
swfLoader.addEventListener(LoaderEvent.LOAD_STATE_CHANGE,onSWFLoaderStateChange);
|
||||
loaderLoadTrait = new LoaderLoadTrait(swfLoader,loadTrait.resource);
|
||||
loaderLoadTrait.addEventListener(MediaErrorEvent.MEDIA_ERROR,onLoadError);
|
||||
swfLoader.load(loaderLoadTrait);
|
||||
}
|
||||
|
||||
override protected function executeUnload(param1:LoadTrait) : void
|
||||
{
|
||||
updateLoadTrait(param1,LoadState.UNLOADING);
|
||||
var _loc2_:PluginLoadTrait = param1 as PluginLoadTrait;
|
||||
unloadFromPluginInfo(_loc2_.pluginInfo);
|
||||
_loc2_.loader.unloadAndStop();
|
||||
updateLoadTrait(param1,LoadState.UNINITIALIZED);
|
||||
}
|
||||
|
||||
private function validateLoadedContent(param1:DisplayObject) : Boolean
|
||||
{
|
||||
var _loc2_:Object = param1.hasOwnProperty(PLUGININFO_PROPERTY_NAME) ? param1[PLUGININFO_PROPERTY_NAME] : null;
|
||||
return _loc2_ != null ? isPluginCompatible(_loc2_) : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import org.osmf.media.LoadableElementBase;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
|
||||
internal class PluginElement extends LoadableElementBase
|
||||
{
|
||||
|
||||
public function PluginElement(param1:PluginLoader, param2:MediaResourceBase = null)
|
||||
{
|
||||
super(param2,param1);
|
||||
}
|
||||
|
||||
override protected function createLoadTrait(param1:MediaResourceBase, param2:LoaderBase) : LoadTrait
|
||||
{
|
||||
return new PluginLoadTrait(param2,param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import org.osmf.media.MediaElement;
|
||||
|
||||
internal class PluginEntry
|
||||
{
|
||||
|
||||
private var _pluginElement:MediaElement;
|
||||
|
||||
private var _state:PluginLoadingState;
|
||||
|
||||
public function PluginEntry(param1:MediaElement, param2:PluginLoadingState)
|
||||
{
|
||||
super();
|
||||
this._pluginElement = param1;
|
||||
this._state = param2;
|
||||
}
|
||||
|
||||
public function get pluginElement() : MediaElement
|
||||
{
|
||||
return this._pluginElement;
|
||||
}
|
||||
|
||||
public function get state() : PluginLoadingState
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public function set state(param1:PluginLoadingState) : void
|
||||
{
|
||||
this._state = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import flash.display.Loader;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfo;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
|
||||
internal class PluginLoadTrait extends LoadTrait
|
||||
{
|
||||
|
||||
private var _pluginInfo:PluginInfo;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
public function PluginLoadTrait(param1:LoaderBase, param2:MediaResourceBase)
|
||||
{
|
||||
super(param1,param2);
|
||||
}
|
||||
|
||||
public function get pluginInfo() : PluginInfo
|
||||
{
|
||||
return this._pluginInfo;
|
||||
}
|
||||
|
||||
public function set pluginInfo(param1:PluginInfo) : void
|
||||
{
|
||||
this._pluginInfo = param1;
|
||||
}
|
||||
|
||||
public function get loader() : Loader
|
||||
{
|
||||
return this._loader;
|
||||
}
|
||||
|
||||
public function set loader(param1:Loader) : void
|
||||
{
|
||||
this._loader = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import flash.display.Loader;
|
||||
import org.osmf.events.MediaError;
|
||||
import org.osmf.events.MediaErrorCodes;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.media.MediaFactory;
|
||||
import org.osmf.media.MediaFactoryItem;
|
||||
import org.osmf.media.PluginInfo;
|
||||
import org.osmf.traits.LoadState;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
import org.osmf.utils.Version;
|
||||
|
||||
internal class PluginLoader extends LoaderBase
|
||||
{
|
||||
|
||||
private static const FRAMEWORK_VERSION_PROPERTY_NAME:String = "frameworkVersion";
|
||||
|
||||
private static const IS_FRAMEWORK_VERSION_SUPPORTED_PROPERTY_NAME:String = "isFrameworkVersionSupported";
|
||||
|
||||
private var minimumSupportedFrameworkVersion:String;
|
||||
|
||||
private var mediaFactory:MediaFactory;
|
||||
|
||||
public function PluginLoader(param1:MediaFactory, param2:String)
|
||||
{
|
||||
super();
|
||||
this.mediaFactory = param1;
|
||||
this.minimumSupportedFrameworkVersion = param2;
|
||||
}
|
||||
|
||||
protected function unloadFromPluginInfo(param1:PluginInfo) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:MediaFactoryItem = null;
|
||||
var _loc4_:MediaFactoryItem = null;
|
||||
if(param1 != null)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < param1.numMediaFactoryItems)
|
||||
{
|
||||
_loc3_ = param1.getMediaFactoryItemAt(_loc2_);
|
||||
_loc4_ = this.mediaFactory.getItemById(_loc3_.id);
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
this.mediaFactory.removeItem(_loc4_);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function loadFromPluginInfo(param1:LoadTrait, param2:PluginInfo, param3:Loader = null) : void
|
||||
{
|
||||
var passedMediaFactory:MediaFactory = null;
|
||||
var i:int = 0;
|
||||
var pluginLoadTrait:PluginLoadTrait = null;
|
||||
var item:MediaFactoryItem = null;
|
||||
var loadTrait:LoadTrait = param1;
|
||||
var pluginInfo:PluginInfo = param2;
|
||||
var loader:Loader = param3;
|
||||
var invalidImplementation:Boolean = false;
|
||||
if(pluginInfo != null)
|
||||
{
|
||||
if(this.isPluginCompatible(pluginInfo))
|
||||
{
|
||||
try
|
||||
{
|
||||
passedMediaFactory = loadTrait.resource.getMetadataValue(PluginInfo.PLUGIN_MEDIAFACTORY_NAMESPACE) as MediaFactory;
|
||||
if(passedMediaFactory == null)
|
||||
{
|
||||
loadTrait.resource.addMetadataValue(PluginInfo.PLUGIN_MEDIAFACTORY_NAMESPACE,this.mediaFactory);
|
||||
}
|
||||
pluginInfo.initializePlugin(loadTrait.resource);
|
||||
i = 0;
|
||||
while(i < pluginInfo.numMediaFactoryItems)
|
||||
{
|
||||
item = pluginInfo.getMediaFactoryItemAt(i);
|
||||
if(item == null)
|
||||
{
|
||||
throw new RangeError();
|
||||
}
|
||||
this.mediaFactory.addItem(item);
|
||||
i++;
|
||||
}
|
||||
pluginLoadTrait = loadTrait as PluginLoadTrait;
|
||||
pluginLoadTrait.pluginInfo = pluginInfo;
|
||||
pluginLoadTrait.loader = loader;
|
||||
updateLoadTrait(pluginLoadTrait,LoadState.READY);
|
||||
}
|
||||
catch(error:RangeError)
|
||||
{
|
||||
invalidImplementation = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
updateLoadTrait(loadTrait,LoadState.LOAD_ERROR);
|
||||
loadTrait.dispatchEvent(new MediaErrorEvent(MediaErrorEvent.MEDIA_ERROR,false,false,new MediaError(MediaErrorCodes.PLUGIN_VERSION_INVALID)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invalidImplementation = true;
|
||||
}
|
||||
if(invalidImplementation)
|
||||
{
|
||||
updateLoadTrait(loadTrait,LoadState.LOAD_ERROR);
|
||||
loadTrait.dispatchEvent(new MediaErrorEvent(MediaErrorEvent.MEDIA_ERROR,false,false,new MediaError(MediaErrorCodes.PLUGIN_IMPLEMENTATION_INVALID)));
|
||||
}
|
||||
}
|
||||
|
||||
protected function isPluginCompatible(param1:Object) : Boolean
|
||||
{
|
||||
var _loc5_:Function = null;
|
||||
var _loc2_:Boolean = false;
|
||||
var _loc3_:String = param1.hasOwnProperty(FRAMEWORK_VERSION_PROPERTY_NAME) ? param1[FRAMEWORK_VERSION_PROPERTY_NAME] : null;
|
||||
var _loc4_:Boolean = this.isPluginVersionSupported(_loc3_);
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = param1.hasOwnProperty(IS_FRAMEWORK_VERSION_SUPPORTED_PROPERTY_NAME) ? param1[IS_FRAMEWORK_VERSION_SUPPORTED_PROPERTY_NAME] as Function : null;
|
||||
if(_loc5_ != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_loc2_ = _loc5_(Version.version);
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function isPluginVersionSupported(param1:String) : Boolean
|
||||
{
|
||||
if(param1 == null || param1.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var _loc2_:Object = VersionUtils.parseVersionString(this.minimumSupportedFrameworkVersion);
|
||||
var _loc3_:Object = VersionUtils.parseVersionString(param1);
|
||||
return _loc3_.major > _loc2_.major || _loc3_.major == _loc2_.major && _loc3_.minor >= _loc2_.minor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
internal class PluginLoadingState
|
||||
{
|
||||
|
||||
public static const LOADING:PluginLoadingState = new PluginLoadingState("Loading");
|
||||
|
||||
public static const LOADED:PluginLoadingState = new PluginLoadingState("Loaded");
|
||||
|
||||
private var _state:String;
|
||||
|
||||
public function PluginLoadingState(param1:String)
|
||||
{
|
||||
super();
|
||||
this._state = param1;
|
||||
}
|
||||
|
||||
public function get state() : String
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.events.MediaFactoryEvent;
|
||||
import org.osmf.events.PluginManagerEvent;
|
||||
import org.osmf.media.MediaElement;
|
||||
import org.osmf.media.MediaFactory;
|
||||
import org.osmf.media.MediaFactoryItem;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfoResource;
|
||||
import org.osmf.media.URLResource;
|
||||
import org.osmf.traits.LoadState;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.MediaTraitType;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
import org.osmf.utils.Version;
|
||||
|
||||
public class PluginManager extends EventDispatcher
|
||||
{
|
||||
|
||||
private static const STATIC_PLUGIN_MEDIA_INFO_ID:String = "org.osmf.plugins.StaticPluginLoader";
|
||||
|
||||
private static const DYNAMIC_PLUGIN_MEDIA_INFO_ID:String = "org.osmf.plugins.DynamicPluginLoader";
|
||||
|
||||
private var _mediaFactory:MediaFactory;
|
||||
|
||||
private var _pluginFactory:MediaFactory;
|
||||
|
||||
private var _pluginMap:Dictionary;
|
||||
|
||||
private var _pluginList:Vector.<PluginEntry>;
|
||||
|
||||
private var notificationFunctions:Vector.<Function>;
|
||||
|
||||
private var createdElements:Dictionary;
|
||||
|
||||
private var minimumSupportedFrameworkVersion:String;
|
||||
|
||||
private var staticPluginLoader:StaticPluginLoader;
|
||||
|
||||
private var dynamicPluginLoader:DynamicPluginLoader;
|
||||
|
||||
public function PluginManager(param1:MediaFactory)
|
||||
{
|
||||
super();
|
||||
this._mediaFactory = param1;
|
||||
this._mediaFactory.addEventListener(MediaFactoryEvent.MEDIA_ELEMENT_CREATE,this.onMediaElementCreate);
|
||||
this.minimumSupportedFrameworkVersion = Version.lastAPICompatibleVersion;
|
||||
this.initPluginFactory();
|
||||
this._pluginMap = new Dictionary();
|
||||
this._pluginList = new Vector.<PluginEntry>();
|
||||
}
|
||||
|
||||
public function loadPlugin(param1:MediaResourceBase) : void
|
||||
{
|
||||
var identifier:Object = null;
|
||||
var pluginEntry:PluginEntry = null;
|
||||
var onLoadStateChange:Function = null;
|
||||
var onMediaError:Function = null;
|
||||
var pluginElement:MediaElement = null;
|
||||
var loadTrait:LoadTrait = null;
|
||||
var resource:MediaResourceBase = param1;
|
||||
onLoadStateChange = function(param1:LoadEvent):void
|
||||
{
|
||||
var _loc2_:PluginLoadTrait = null;
|
||||
if(param1.loadState == LoadState.READY)
|
||||
{
|
||||
pluginEntry.state = PluginLoadingState.LOADED;
|
||||
_pluginList.push(pluginEntry);
|
||||
_loc2_ = pluginElement.getTrait(MediaTraitType.LOAD) as PluginLoadTrait;
|
||||
if(_loc2_.pluginInfo.mediaElementCreationNotificationFunction != null)
|
||||
{
|
||||
invokeMediaElementCreationNotificationForCreatedMediaElements(_loc2_.pluginInfo.mediaElementCreationNotificationFunction);
|
||||
if(notificationFunctions == null)
|
||||
{
|
||||
notificationFunctions = new Vector.<Function>();
|
||||
}
|
||||
notificationFunctions.push(_loc2_.pluginInfo.mediaElementCreationNotificationFunction);
|
||||
}
|
||||
dispatchEvent(new PluginManagerEvent(PluginManagerEvent.PLUGIN_LOAD,false,false,resource));
|
||||
}
|
||||
else if(param1.loadState == LoadState.LOAD_ERROR)
|
||||
{
|
||||
delete _pluginMap[identifier];
|
||||
dispatchEvent(new PluginManagerEvent(PluginManagerEvent.PLUGIN_LOAD_ERROR,false,false,resource));
|
||||
}
|
||||
};
|
||||
onMediaError = function(param1:MediaErrorEvent):void
|
||||
{
|
||||
dispatchEvent(param1.clone());
|
||||
};
|
||||
if(resource == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
identifier = this.getPluginIdentifier(resource);
|
||||
pluginEntry = this._pluginMap[identifier] as PluginEntry;
|
||||
if(pluginEntry != null)
|
||||
{
|
||||
dispatchEvent(new PluginManagerEvent(PluginManagerEvent.PLUGIN_LOAD,false,false,resource));
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginElement = this._pluginFactory.createMediaElement(resource);
|
||||
if(pluginElement != null)
|
||||
{
|
||||
pluginEntry = new PluginEntry(pluginElement,PluginLoadingState.LOADING);
|
||||
this._pluginMap[identifier] = pluginEntry;
|
||||
loadTrait = pluginElement.getTrait(MediaTraitType.LOAD) as LoadTrait;
|
||||
if(loadTrait != null)
|
||||
{
|
||||
loadTrait.addEventListener(LoadEvent.LOAD_STATE_CHANGE,onLoadStateChange);
|
||||
loadTrait.addEventListener(MediaErrorEvent.MEDIA_ERROR,onMediaError);
|
||||
loadTrait.load();
|
||||
}
|
||||
else
|
||||
{
|
||||
dispatchEvent(new PluginManagerEvent(PluginManagerEvent.PLUGIN_LOAD_ERROR,false,false,resource));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dispatchEvent(new PluginManagerEvent(PluginManagerEvent.PLUGIN_LOAD_ERROR,false,false,resource));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get mediaFactory() : MediaFactory
|
||||
{
|
||||
return this._mediaFactory;
|
||||
}
|
||||
|
||||
private function getPluginIdentifier(param1:MediaResourceBase) : Object
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
if(param1 is URLResource)
|
||||
{
|
||||
_loc2_ = (param1 as URLResource).url;
|
||||
}
|
||||
else if(param1 is PluginInfoResource)
|
||||
{
|
||||
_loc2_ = (param1 as PluginInfoResource).pluginInfo;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function initPluginFactory() : void
|
||||
{
|
||||
this._pluginFactory = new MediaFactory();
|
||||
this.staticPluginLoader = new StaticPluginLoader(this.mediaFactory,this.minimumSupportedFrameworkVersion);
|
||||
this.dynamicPluginLoader = new DynamicPluginLoader(this.mediaFactory,this.minimumSupportedFrameworkVersion);
|
||||
var _loc1_:MediaFactoryItem = new MediaFactoryItem(STATIC_PLUGIN_MEDIA_INFO_ID,this.staticPluginLoader.canHandleResource,this.createStaticPluginElement);
|
||||
this._pluginFactory.addItem(_loc1_);
|
||||
var _loc2_:MediaFactoryItem = new MediaFactoryItem(DYNAMIC_PLUGIN_MEDIA_INFO_ID,this.dynamicPluginLoader.canHandleResource,this.createDynamicPluginElement);
|
||||
this._pluginFactory.addItem(_loc2_);
|
||||
}
|
||||
|
||||
private function createStaticPluginElement() : MediaElement
|
||||
{
|
||||
return new PluginElement(this.staticPluginLoader);
|
||||
}
|
||||
|
||||
private function createDynamicPluginElement() : MediaElement
|
||||
{
|
||||
return new PluginElement(this.dynamicPluginLoader);
|
||||
}
|
||||
|
||||
private function onMediaElementCreate(param1:MediaFactoryEvent) : void
|
||||
{
|
||||
this.invokeMediaElementCreationNotifications(param1.mediaElement);
|
||||
if(this.createdElements == null)
|
||||
{
|
||||
this.createdElements = new Dictionary(true);
|
||||
}
|
||||
this.createdElements[param1.mediaElement] = true;
|
||||
}
|
||||
|
||||
private function invokeMediaElementCreationNotifications(param1:MediaElement) : void
|
||||
{
|
||||
var _loc2_:Function = null;
|
||||
for each(_loc2_ in this.notificationFunctions)
|
||||
{
|
||||
this.invokeMediaElementCreationNotificationFunction(_loc2_,param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function invokeMediaElementCreationNotificationFunction(param1:Function, param2:MediaElement) : void
|
||||
{
|
||||
try
|
||||
{
|
||||
param1.call(null,param2);
|
||||
}
|
||||
catch(error:Error)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private function invokeMediaElementCreationNotificationForCreatedMediaElements(param1:Function) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
for(_loc2_ in this.createdElements)
|
||||
{
|
||||
this.invokeMediaElementCreationNotificationFunction(param1,_loc2_ as MediaElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
import org.osmf.media.MediaFactory;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.media.PluginInfo;
|
||||
import org.osmf.media.PluginInfoResource;
|
||||
import org.osmf.traits.LoadState;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
|
||||
internal class StaticPluginLoader extends PluginLoader
|
||||
{
|
||||
|
||||
public function StaticPluginLoader(param1:MediaFactory, param2:String)
|
||||
{
|
||||
super(param1,param2);
|
||||
}
|
||||
|
||||
override public function canHandleResource(param1:MediaResourceBase) : Boolean
|
||||
{
|
||||
return param1 is PluginInfoResource;
|
||||
}
|
||||
|
||||
override protected function executeLoad(param1:LoadTrait) : void
|
||||
{
|
||||
updateLoadTrait(param1,LoadState.LOADING);
|
||||
var _loc2_:PluginInfoResource = param1.resource as PluginInfoResource;
|
||||
var _loc3_:PluginInfo = _loc2_.pluginInfo;
|
||||
loadFromPluginInfo(param1,_loc3_);
|
||||
}
|
||||
|
||||
override protected function executeUnload(param1:LoadTrait) : void
|
||||
{
|
||||
var _loc2_:PluginLoadTrait = param1 as PluginLoadTrait;
|
||||
var _loc3_:PluginInfo = _loc2_.pluginInfo;
|
||||
updateLoadTrait(param1,LoadState.UNLOADING);
|
||||
unloadFromPluginInfo(_loc3_);
|
||||
updateLoadTrait(param1,LoadState.UNINITIALIZED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.osmf.media.pluginClasses
|
||||
{
|
||||
public class VersionUtils
|
||||
{
|
||||
|
||||
public function VersionUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function parseVersionString(param1:String) : Object
|
||||
{
|
||||
var _loc2_:Array = param1.split(".");
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(_loc2_.length >= 1)
|
||||
{
|
||||
_loc3_ = parseInt(_loc2_[0]);
|
||||
}
|
||||
if(_loc2_.length >= 2)
|
||||
{
|
||||
_loc4_ = parseInt(_loc2_[1]);
|
||||
if(_loc4_ < 10)
|
||||
{
|
||||
_loc4_ *= 10;
|
||||
}
|
||||
}
|
||||
return {
|
||||
"major":_loc3_,
|
||||
"minor":_loc4_
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user