mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09: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,29 @@
|
||||
package org.osmf.captioning.loader
|
||||
{
|
||||
import org.osmf.captioning.model.CaptioningDocument;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
|
||||
public class CaptioningLoadTrait extends LoadTrait
|
||||
{
|
||||
|
||||
private var _document:CaptioningDocument;
|
||||
|
||||
public function CaptioningLoadTrait(param1:LoaderBase, param2:MediaResourceBase)
|
||||
{
|
||||
super(param1,param2);
|
||||
}
|
||||
|
||||
public function get document() : CaptioningDocument
|
||||
{
|
||||
return _document;
|
||||
}
|
||||
|
||||
public function set document(param1:CaptioningDocument) : void
|
||||
{
|
||||
_document = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.osmf.captioning.loader
|
||||
{
|
||||
import org.osmf.captioning.model.CaptioningDocument;
|
||||
import org.osmf.captioning.parsers.DFXPParser;
|
||||
import org.osmf.captioning.parsers.ICaptioningParser;
|
||||
import org.osmf.events.LoaderEvent;
|
||||
import org.osmf.events.MediaErrorEvent;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.traits.LoadTrait;
|
||||
import org.osmf.traits.LoaderBase;
|
||||
import org.osmf.utils.HTTPLoadTrait;
|
||||
import org.osmf.utils.HTTPLoader;
|
||||
|
||||
public class CaptioningLoader extends LoaderBase
|
||||
{
|
||||
|
||||
private var httpLoader:HTTPLoader;
|
||||
|
||||
public function CaptioningLoader(param1:HTTPLoader = null)
|
||||
{
|
||||
super();
|
||||
this.httpLoader = param1 != null ? param1 : new HTTPLoader();
|
||||
}
|
||||
|
||||
override public function canHandleResource(param1:MediaResourceBase) : Boolean
|
||||
{
|
||||
return httpLoader.canHandleResource(param1);
|
||||
}
|
||||
|
||||
override protected function executeLoad(param1:LoadTrait) : void
|
||||
{
|
||||
var httpLoadTrait:HTTPLoadTrait;
|
||||
var loadTrait:LoadTrait = param1;
|
||||
var onHTTPLoaderStateChange:* = function(param1:LoaderEvent):void
|
||||
{
|
||||
var _loc2_:ICaptioningParser = null;
|
||||
var _loc3_:CaptioningDocument = null;
|
||||
if(param1.newState == "ready")
|
||||
{
|
||||
httpLoader.removeEventListener("loadStateChange",onHTTPLoaderStateChange);
|
||||
httpLoadTrait.removeEventListener("mediaError",onLoadError);
|
||||
_loc2_ = createCaptioningParser();
|
||||
try
|
||||
{
|
||||
_loc3_ = _loc2_.parse(httpLoadTrait.urlLoader.data.toString());
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
updateLoadTrait(loadTrait,"loadError");
|
||||
}
|
||||
CaptioningLoadTrait(loadTrait).document = _loc3_;
|
||||
updateLoadTrait(loadTrait,"ready");
|
||||
}
|
||||
else if(param1.newState == "loadError")
|
||||
{
|
||||
httpLoader.removeEventListener("loadStateChange",onHTTPLoaderStateChange);
|
||||
updateLoadTrait(loadTrait,param1.newState);
|
||||
}
|
||||
};
|
||||
var onLoadError:* = function(param1:MediaErrorEvent):void
|
||||
{
|
||||
httpLoadTrait.removeEventListener("mediaError",onLoadError);
|
||||
loadTrait.dispatchEvent(param1.clone());
|
||||
};
|
||||
updateLoadTrait(loadTrait,"loading");
|
||||
httpLoader.addEventListener("loadStateChange",onHTTPLoaderStateChange);
|
||||
httpLoadTrait = new HTTPLoadTrait(httpLoader,loadTrait.resource);
|
||||
httpLoadTrait.addEventListener("mediaError",onLoadError);
|
||||
httpLoader.load(httpLoadTrait);
|
||||
}
|
||||
|
||||
override protected function executeUnload(param1:LoadTrait) : void
|
||||
{
|
||||
updateLoadTrait(param1,"unloading");
|
||||
updateLoadTrait(param1,"uninitialized");
|
||||
}
|
||||
|
||||
protected function createCaptioningParser() : ICaptioningParser
|
||||
{
|
||||
return new DFXPParser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user