mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 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,40 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public class CuePoint extends TimelineMarker
|
||||
{
|
||||
|
||||
public static const EMBEDDED_CUEPOINTS_NAMESPACE:String = "http://www.osmf.org/timeline/embeddedCuePoints/1.0";
|
||||
|
||||
public static const DYNAMIC_CUEPOINTS_NAMESPACE:String = "http://www.osmf.org/timeline/dynamicCuePoints/1.0";
|
||||
|
||||
private var _name:String;
|
||||
|
||||
private var _type:String;
|
||||
|
||||
private var _parameters:Object;
|
||||
|
||||
public function CuePoint(param1:String, param2:Number, param3:String, param4:Object, param5:Number = NaN)
|
||||
{
|
||||
super(param2,param5);
|
||||
_type = param1;
|
||||
_name = param3;
|
||||
_parameters = param4;
|
||||
}
|
||||
|
||||
public function get type() : String
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public function get name() : String
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public function get parameters() : Object
|
||||
{
|
||||
return _parameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class Metadata extends EventDispatcher
|
||||
{
|
||||
|
||||
private var data:Dictionary;
|
||||
|
||||
public function Metadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function getValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
return data != null ? data[param1] : null;
|
||||
}
|
||||
|
||||
public function addValue(param1:String, param2:Object) : void
|
||||
{
|
||||
var _loc4_:Event = null;
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
if(data == null)
|
||||
{
|
||||
data = new Dictionary();
|
||||
}
|
||||
var _loc3_:* = data[param1];
|
||||
data[param1] = param2;
|
||||
if(_loc3_ != param2)
|
||||
{
|
||||
_loc4_ = _loc3_ === undefined ? new MetadataEvent("valueAdd",false,false,param1,param2) : new MetadataEvent("valueChange",false,false,param1,param2,_loc3_);
|
||||
dispatchEvent(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
var _loc2_:* = data[param1];
|
||||
if(_loc2_ !== undefined)
|
||||
{
|
||||
delete data[param1];
|
||||
dispatchEvent(new MetadataEvent("valueRemove",false,false,param1,_loc2_));
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public function get keys() : Vector.<String>
|
||||
{
|
||||
var _loc1_:Vector.<String> = new Vector.<String>();
|
||||
if(data != null)
|
||||
{
|
||||
for(var _loc2_:Object in data)
|
||||
{
|
||||
_loc1_.push(_loc2_);
|
||||
}
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function get synthesizer() : MetadataSynthesizer
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public final class MetadataNamespaces
|
||||
{
|
||||
|
||||
public static const MEDIA_ELEMENT_METADATA:String = "http://www.osmf.org/mediaElement/1.0";
|
||||
|
||||
public static const DERIVED_RESOURCE_METADATA:String = "http://www.osmf.org/derivedResource/1.0";
|
||||
|
||||
public static const FMS_SERVER_VERSION_METADATA:String = "http://www.osmf.org/fmsServerVersion/1.0";
|
||||
|
||||
public static const ELEMENT_ID:String = "http://www.osmf.org/layout/elementId/1.0";
|
||||
|
||||
public static const LAYOUT_RENDERER_TYPE:String = "http://www.osmf.org/layout/renderer_type/1.0";
|
||||
|
||||
public static const ABSOLUTE_LAYOUT_PARAMETERS:String = "http://www.osmf.org/layout/absolute/1.0";
|
||||
|
||||
public static const RELATIVE_LAYOUT_PARAMETERS:String = "http://www.osmf.org/layout/relative/1.0";
|
||||
|
||||
public static const ANCHOR_LAYOUT_PARAMETERS:String = "http://www.osmf.org/layout/anchor/1.0";
|
||||
|
||||
public static const PADDING_LAYOUT_PARAMETERS:String = "http://www.osmf.org/layout/padding/1.0";
|
||||
|
||||
public static const LAYOUT_ATTRIBUTES:String = "http://www.osmf.org/layout/attributes/1.0";
|
||||
|
||||
public static const BOX_LAYOUT_ATTRIBUTES:String = "http://www.osmf.org/layout/attributes/box/1.0";
|
||||
|
||||
public static const DRM_METADATA:String = "http://www.osmf.org/drm/1.0";
|
||||
|
||||
public static const MULTICAST_INFO:String = "http://www.osmf.org/multicast/info/1.0";
|
||||
|
||||
public static const MULTICAST_NET_LOADER:String = "http://www.osmf.org/multicast/netloader/1.0";
|
||||
|
||||
public static const DVR_METADATA:String = "http://www.osmf.org/dvr/1.0";
|
||||
|
||||
public static const DRM_ADDITIONAL_HEADER_KEY:String = "DRMAdditionalHeader";
|
||||
|
||||
public static const HTTP_STREAMING_METADATA:String = "http://www.osmf.org/httpstreaming/1.0";
|
||||
|
||||
public static const HTTP_STREAMING_BOOTSTRAP_KEY:String = "bootstrap";
|
||||
|
||||
public static const HTTP_STREAMING_STREAM_METADATA_KEY:String = "streamMetadata";
|
||||
|
||||
public static const HTTP_STREAMING_XMP_METADATA_KEY:String = "xmpMetadata";
|
||||
|
||||
public static const HTTP_STREAMING_SERVER_BASE_URLS_KEY:String = "serverBaseUrls";
|
||||
|
||||
public static const HTTP_STREAMING_DVR_BEGIN_OFFSET_KEY:String = "beginOffset";
|
||||
|
||||
public static const HTTP_STREAMING_DVR_END_OFFSET_KEY:String = "endOffset";
|
||||
|
||||
public static const HTTP_STREAMING_DVR_OFFLINE_KEY:String = "dvrOffline";
|
||||
|
||||
public static const HTTP_STREAMING_DVR_ID_KEY:String = "dvrId";
|
||||
|
||||
public function MetadataNamespaces()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public class MetadataSynthesizer
|
||||
{
|
||||
|
||||
public function MetadataSynthesizer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function synthesize(param1:String, param2:Metadata, param3:Vector.<Metadata>, param4:String, param5:Metadata) : Metadata
|
||||
{
|
||||
var _loc6_:Metadata = null;
|
||||
if(param4 == "serial" && param5)
|
||||
{
|
||||
_loc6_ = param5.getValue(param1) as Metadata;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = param3.length >= 1 ? param3[0] : null;
|
||||
}
|
||||
return _loc6_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
import flash.errors.IllegalOperationError;
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class MetadataWatcher
|
||||
{
|
||||
|
||||
private var parentMetadata:Metadata;
|
||||
|
||||
private var namespaceURL:String;
|
||||
|
||||
private var key:String;
|
||||
|
||||
private var callback:Function;
|
||||
|
||||
private var currentMetadata:Metadata;
|
||||
|
||||
private var watching:Boolean;
|
||||
|
||||
public function MetadataWatcher(param1:Metadata, param2:String, param3:String, param4:Function)
|
||||
{
|
||||
super();
|
||||
if(param1 == null || param2 == null || param4 == null)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
this.parentMetadata = param1;
|
||||
this.namespaceURL = param2;
|
||||
this.key = param3;
|
||||
this.callback = param4;
|
||||
}
|
||||
|
||||
public function watch(param1:Boolean = true) : void
|
||||
{
|
||||
if(watching == false)
|
||||
{
|
||||
watching = true;
|
||||
parentMetadata.addEventListener("valueAdd",onMetadataAdd,false,0,true);
|
||||
processWatchedMetadataChange(parentMetadata.getValue(namespaceURL) as Metadata);
|
||||
if(param1 == true)
|
||||
{
|
||||
if(key != null)
|
||||
{
|
||||
callback(currentMetadata ? currentMetadata.getValue(key) : undefined);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(currentMetadata ? currentMetadata : undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function unwatch() : void
|
||||
{
|
||||
if(watching == true)
|
||||
{
|
||||
processWatchedMetadataChange(null,false);
|
||||
parentMetadata.removeEventListener("valueAdd",onMetadataAdd);
|
||||
watching = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function processWatchedMetadataChange(param1:Metadata, param2:Boolean = true) : void
|
||||
{
|
||||
var _loc3_:Metadata = null;
|
||||
if(currentMetadata != param1)
|
||||
{
|
||||
_loc3_ = currentMetadata;
|
||||
if(currentMetadata)
|
||||
{
|
||||
currentMetadata.removeEventListener("valueChange",onValueChange);
|
||||
currentMetadata.removeEventListener("valueAdd",onValueAdd);
|
||||
currentMetadata.removeEventListener("valueRemove",onValueRemove);
|
||||
parentMetadata.removeEventListener("valueRemove",onMetadataRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
parentMetadata.removeEventListener("valueAdd",onMetadataAdd);
|
||||
}
|
||||
currentMetadata = param1;
|
||||
if(param1)
|
||||
{
|
||||
param1.addEventListener("valueChange",onValueChange,false,0,true);
|
||||
param1.addEventListener("valueAdd",onValueAdd,false,0,true);
|
||||
param1.addEventListener("valueRemove",onValueRemove,false,0,true);
|
||||
parentMetadata.addEventListener("valueRemove",onMetadataRemove);
|
||||
}
|
||||
else
|
||||
{
|
||||
parentMetadata.addEventListener("valueAdd",onMetadataAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onMetadataAdd(param1:MetadataEvent) : void
|
||||
{
|
||||
var _loc2_:Metadata = param1.value as Metadata;
|
||||
if(_loc2_ && param1.key == namespaceURL)
|
||||
{
|
||||
processWatchedMetadataChange(_loc2_);
|
||||
if(key == null)
|
||||
{
|
||||
callback(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(_loc2_.getValue(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onMetadataRemove(param1:MetadataEvent) : void
|
||||
{
|
||||
var _loc2_:Metadata = param1.value as Metadata;
|
||||
if(_loc2_ && param1.key == namespaceURL)
|
||||
{
|
||||
processWatchedMetadataChange(null);
|
||||
callback(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
private function onValueChange(param1:MetadataEvent) : void
|
||||
{
|
||||
if(key)
|
||||
{
|
||||
if(key == param1.key)
|
||||
{
|
||||
callback(param1.value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(param1.target as Metadata);
|
||||
}
|
||||
}
|
||||
|
||||
private function onValueAdd(param1:MetadataEvent) : void
|
||||
{
|
||||
if(key)
|
||||
{
|
||||
if(key == param1.key)
|
||||
{
|
||||
callback(param1.value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(param1.target as Metadata);
|
||||
}
|
||||
}
|
||||
|
||||
private function onValueRemove(param1:MetadataEvent) : void
|
||||
{
|
||||
if(key)
|
||||
{
|
||||
if(key == param1.key)
|
||||
{
|
||||
callback(undefined);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(param1.target as Metadata);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public class NonSynthesizingMetadata extends Metadata
|
||||
{
|
||||
|
||||
private var _synthesizer:MetadataSynthesizer = new NullMetadataSynthesizer();
|
||||
|
||||
public function NonSynthesizingMetadata()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function get synthesizer() : MetadataSynthesizer
|
||||
{
|
||||
return _synthesizer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public class NullMetadataSynthesizer extends MetadataSynthesizer
|
||||
{
|
||||
|
||||
public function NullMetadataSynthesizer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function synthesize(param1:String, param2:Metadata, param3:Vector.<Metadata>, param4:String, param5:Metadata) : Metadata
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
public class TimelineMarker
|
||||
{
|
||||
|
||||
private var _time:Number;
|
||||
|
||||
private var _duration:Number;
|
||||
|
||||
public function TimelineMarker(param1:Number, param2:Number = NaN)
|
||||
{
|
||||
super();
|
||||
_time = param1;
|
||||
_duration = param2;
|
||||
}
|
||||
|
||||
public function get time() : Number
|
||||
{
|
||||
return _time;
|
||||
}
|
||||
|
||||
public function get duration() : Number
|
||||
{
|
||||
return _duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
package org.osmf.metadata
|
||||
{
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Dictionary;
|
||||
import flash.utils.Timer;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.events.MetadataEvent;
|
||||
import org.osmf.events.PlayEvent;
|
||||
import org.osmf.events.SeekEvent;
|
||||
import org.osmf.events.TimelineMetadataEvent;
|
||||
import org.osmf.media.MediaElement;
|
||||
import org.osmf.traits.PlayTrait;
|
||||
import org.osmf.traits.SeekTrait;
|
||||
import org.osmf.traits.TimeTrait;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class TimelineMetadata extends Metadata
|
||||
{
|
||||
|
||||
private static const CHECK_INTERVAL:Number = 100;
|
||||
|
||||
private static const TOLERANCE:Number = 0.25;
|
||||
|
||||
private var temporalKeyCollection:Vector.<Number>;
|
||||
|
||||
private var temporalValueCollection:Vector.<TimelineMarker>;
|
||||
|
||||
private var media:MediaElement;
|
||||
|
||||
private var timeTrait:TimeTrait;
|
||||
|
||||
private var seekTrait:SeekTrait;
|
||||
|
||||
private var playTrait:PlayTrait;
|
||||
|
||||
private var lastFiredTemporalMetadataIndex:int;
|
||||
|
||||
private var intervalTimer:Timer;
|
||||
|
||||
private var restartTimer:Boolean;
|
||||
|
||||
private var _enabled:Boolean;
|
||||
|
||||
private var durationTimers:Dictionary;
|
||||
|
||||
public function TimelineMetadata(param1:MediaElement)
|
||||
{
|
||||
super();
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
this.media = param1;
|
||||
_enabled = true;
|
||||
intervalTimer = new Timer(100);
|
||||
intervalTimer.addEventListener("timer",onIntervalTimer);
|
||||
timeTrait = param1.getTrait("time") as TimeTrait;
|
||||
seekTrait = param1.getTrait("seek") as SeekTrait;
|
||||
setupTraitEventListener("seek");
|
||||
playTrait = param1.getTrait("play") as PlayTrait;
|
||||
setupTraitEventListener("play");
|
||||
param1.addEventListener("traitAdd",onTraitAdd);
|
||||
param1.addEventListener("traitRemove",onTraitRemove);
|
||||
}
|
||||
|
||||
public function get numMarkers() : int
|
||||
{
|
||||
return temporalValueCollection ? temporalValueCollection.length : 0;
|
||||
}
|
||||
|
||||
public function getMarkerAt(param1:int) : TimelineMarker
|
||||
{
|
||||
if(param1 >= 0 && temporalValueCollection != null && param1 < temporalValueCollection.length)
|
||||
{
|
||||
return temporalValueCollection[param1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function addMarker(param1:TimelineMarker) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("invalidParam"));
|
||||
}
|
||||
addValue("" + param1.time,param1);
|
||||
}
|
||||
|
||||
public function removeMarker(param1:TimelineMarker) : TimelineMarker
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("invalidParam"));
|
||||
}
|
||||
return removeValue("" + param1.time);
|
||||
}
|
||||
|
||||
override public function addValue(param1:String, param2:Object) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Number = new Number(param1);
|
||||
var _loc3_:TimelineMarker = param2 as TimelineMarker;
|
||||
if(param1 == null || isNaN(_loc5_) || _loc5_ < 0 || _loc3_ == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("invalidParam"));
|
||||
}
|
||||
if(temporalValueCollection == null)
|
||||
{
|
||||
temporalKeyCollection = new Vector.<Number>();
|
||||
temporalKeyCollection.push(_loc5_);
|
||||
temporalValueCollection = new Vector.<TimelineMarker>();
|
||||
temporalValueCollection.push(param2);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = findTemporalMetadata(0,temporalValueCollection.length - 1,_loc5_);
|
||||
if(_loc4_ < 0)
|
||||
{
|
||||
_loc4_ *= -1;
|
||||
temporalKeyCollection.splice(_loc4_,0,_loc5_);
|
||||
temporalValueCollection.splice(_loc4_,0,_loc3_);
|
||||
}
|
||||
else if(_loc4_ == 0 && _loc5_ != temporalKeyCollection[0])
|
||||
{
|
||||
temporalKeyCollection.splice(_loc4_,0,_loc5_);
|
||||
temporalValueCollection.splice(_loc4_,0,_loc3_);
|
||||
}
|
||||
else
|
||||
{
|
||||
temporalKeyCollection[_loc4_] = _loc5_;
|
||||
temporalValueCollection[_loc4_] = _loc3_;
|
||||
}
|
||||
}
|
||||
enabled = true;
|
||||
dispatchEvent(new MetadataEvent("valueAdd",false,false,param1,_loc3_));
|
||||
dispatchEvent(new TimelineMetadataEvent("markerAdd",false,false,_loc3_));
|
||||
}
|
||||
|
||||
override public function removeValue(param1:String) : *
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
var _loc4_:Number = new Number(param1);
|
||||
var _loc2_:* = null;
|
||||
var _loc3_:int = int(temporalValueCollection ? findTemporalMetadata(0,temporalValueCollection.length - 1,_loc4_) : -1);
|
||||
if(_loc3_ >= 0)
|
||||
{
|
||||
temporalKeyCollection.splice(_loc3_,1);
|
||||
_loc2_ = temporalValueCollection.splice(_loc3_,1)[0];
|
||||
if(temporalValueCollection.length == 0)
|
||||
{
|
||||
reset(false);
|
||||
temporalValueCollection = null;
|
||||
temporalKeyCollection = null;
|
||||
}
|
||||
dispatchEvent(new MetadataEvent("valueRemove",false,false,param1,_loc2_));
|
||||
dispatchEvent(new TimelineMetadataEvent("markerRemove",false,false,_loc2_ as TimelineMarker));
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
override public function getValue(param1:String) : *
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Number = NaN;
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString("nullParam"));
|
||||
}
|
||||
var _loc4_:Number = new Number(param1);
|
||||
if(!isNaN(_loc4_))
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < temporalKeyCollection.length)
|
||||
{
|
||||
_loc3_ = temporalKeyCollection[_loc2_];
|
||||
if(_loc3_ == _loc4_)
|
||||
{
|
||||
return temporalValueCollection[_loc2_];
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get enabled() : Boolean
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public function set enabled(param1:Boolean) : void
|
||||
{
|
||||
_enabled = param1;
|
||||
reset(param1);
|
||||
}
|
||||
|
||||
private function startTimer(param1:Boolean = true) : void
|
||||
{
|
||||
if(!param1)
|
||||
{
|
||||
intervalTimer.stop();
|
||||
}
|
||||
else if(timeTrait != null && temporalValueCollection != null && temporalValueCollection.length > 0 && restartTimer && enabled && !intervalTimer.running)
|
||||
{
|
||||
if(playTrait != null && playTrait.playState == "playing")
|
||||
{
|
||||
intervalTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function reset(param1:Boolean) : void
|
||||
{
|
||||
lastFiredTemporalMetadataIndex = -1;
|
||||
restartTimer = true;
|
||||
intervalTimer.reset();
|
||||
intervalTimer.delay = 100;
|
||||
if(param1)
|
||||
{
|
||||
this.startTimer();
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForTemporalMetadata() : void
|
||||
{
|
||||
var _loc1_:Number = timeTrait.currentTime;
|
||||
var _loc2_:int = findTemporalMetadata(lastFiredTemporalMetadataIndex + 1,temporalValueCollection.length - 1,_loc1_);
|
||||
if(_loc2_ <= 0)
|
||||
{
|
||||
_loc2_ *= -1;
|
||||
_loc2_ = _loc2_ > 0 ? _loc2_ - 1 : 0;
|
||||
}
|
||||
if(!checkTemporalMetadata(_loc2_,_loc1_) && _loc2_ + 1 < temporalValueCollection.length)
|
||||
{
|
||||
checkTemporalMetadata(_loc2_ + 1,_loc1_);
|
||||
}
|
||||
}
|
||||
|
||||
private function setupTraitEventListener(param1:String, param2:Boolean = true) : void
|
||||
{
|
||||
var _loc3_:PlayEvent = null;
|
||||
if(param2)
|
||||
{
|
||||
if(param1 == "seek" && seekTrait != null)
|
||||
{
|
||||
seekTrait.addEventListener("seekingChange",onSeekingChange);
|
||||
}
|
||||
else if(param1 == "play" && playTrait != null)
|
||||
{
|
||||
playTrait.addEventListener("playStateChange",onPlayStateChange);
|
||||
if(playTrait.playState == "playing")
|
||||
{
|
||||
_loc3_ = new PlayEvent("playStateChange",false,false,"playing");
|
||||
onPlayStateChange(_loc3_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(param1 == "seek" && seekTrait != null)
|
||||
{
|
||||
seekTrait.removeEventListener("seekingChange",onSeekingChange);
|
||||
}
|
||||
else if(param1 == "play" && playTrait != null)
|
||||
{
|
||||
playTrait.removeEventListener("playStateChange",onPlayStateChange);
|
||||
}
|
||||
}
|
||||
|
||||
private function onSeekingChange(param1:SeekEvent) : void
|
||||
{
|
||||
if(param1.seeking)
|
||||
{
|
||||
reset(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayStateChange(param1:PlayEvent) : void
|
||||
{
|
||||
var _loc2_:* = null;
|
||||
if(param1.playState == "playing")
|
||||
{
|
||||
if(durationTimers != null)
|
||||
{
|
||||
for each(_loc2_ in durationTimers)
|
||||
{
|
||||
_loc2_.start();
|
||||
}
|
||||
}
|
||||
startTimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(durationTimers != null)
|
||||
{
|
||||
for each(_loc2_ in durationTimers)
|
||||
{
|
||||
_loc2_.stop();
|
||||
}
|
||||
}
|
||||
startTimer(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function findTemporalMetadata(param1:int, param2:int, param3:Number) : int
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
if(param1 <= param2)
|
||||
{
|
||||
_loc4_ = (param1 + param2) / 2;
|
||||
if(param3 == temporalKeyCollection[_loc4_])
|
||||
{
|
||||
return _loc4_;
|
||||
}
|
||||
if(param3 < temporalKeyCollection[_loc4_])
|
||||
{
|
||||
return findTemporalMetadata(param1,_loc4_ - 1,param3);
|
||||
}
|
||||
return findTemporalMetadata(_loc4_ + 1,param2,param3);
|
||||
}
|
||||
return -param1;
|
||||
}
|
||||
|
||||
private function dispatchTemporalEvents(param1:int) : void
|
||||
{
|
||||
var timer:Timer;
|
||||
var endTime:Number;
|
||||
var onDurationTimer:*;
|
||||
var index:int = param1;
|
||||
var marker:TimelineMarker = temporalValueCollection[index];
|
||||
dispatchEvent(new TimelineMetadataEvent("markerTimeReached",false,false,marker));
|
||||
if(marker.duration > 0)
|
||||
{
|
||||
onDurationTimer = function(param1:TimerEvent):void
|
||||
{
|
||||
if(timeTrait && timeTrait.currentTime >= endTime)
|
||||
{
|
||||
timer.removeEventListener("timer",onDurationTimer);
|
||||
delete durationTimers[marker];
|
||||
dispatchEvent(new TimelineMetadataEvent("markerDurationReached",false,false,marker));
|
||||
}
|
||||
};
|
||||
timer = new Timer(100);
|
||||
endTime = marker.time + marker.duration;
|
||||
if(durationTimers == null)
|
||||
{
|
||||
durationTimers = new Dictionary();
|
||||
}
|
||||
durationTimers[marker] = timer;
|
||||
timer.addEventListener("timer",onDurationTimer);
|
||||
timer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function checkTemporalMetadata(param1:int, param2:Number) : Boolean
|
||||
{
|
||||
var _loc4_:Number = NaN;
|
||||
var _loc5_:Number = NaN;
|
||||
var _loc6_:Number = NaN;
|
||||
if(!temporalValueCollection || !temporalValueCollection.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var _loc3_:Boolean = false;
|
||||
if(temporalValueCollection[param1].time >= param2 - 0.25 && temporalValueCollection[param1].time <= param2 + 0.25 && param1 != lastFiredTemporalMetadataIndex)
|
||||
{
|
||||
lastFiredTemporalMetadataIndex = param1;
|
||||
dispatchTemporalEvents(param1);
|
||||
_loc4_ = temporalKeyCollection[param1];
|
||||
_loc5_ = calcNextTime(param1);
|
||||
_loc6_ = (_loc5_ - _loc4_) * 1000 / 4;
|
||||
_loc6_ = _loc6_ > 100 ? _loc6_ : 100;
|
||||
if(_loc4_ == _loc5_)
|
||||
{
|
||||
startTimer(false);
|
||||
restartTimer = false;
|
||||
}
|
||||
else if(_loc6_ != intervalTimer.delay)
|
||||
{
|
||||
intervalTimer.reset();
|
||||
intervalTimer.delay = _loc6_;
|
||||
startTimer();
|
||||
}
|
||||
_loc3_ = true;
|
||||
}
|
||||
else if(intervalTimer.delay != 100 && param2 + intervalTimer.delay / 1000 > calcNextTime(param1))
|
||||
{
|
||||
this.intervalTimer.reset();
|
||||
this.intervalTimer.delay = 100;
|
||||
startTimer();
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function calcNextTime(param1:int) : Number
|
||||
{
|
||||
return temporalValueCollection[param1 + 1 < temporalKeyCollection.length ? param1 + 1 : temporalKeyCollection.length - 1].time;
|
||||
}
|
||||
|
||||
private function onIntervalTimer(param1:TimerEvent) : void
|
||||
{
|
||||
checkForTemporalMetadata();
|
||||
}
|
||||
|
||||
private function onTraitAdd(param1:MediaElementEvent) : void
|
||||
{
|
||||
switch(param1.traitType)
|
||||
{
|
||||
case "time":
|
||||
timeTrait = media.getTrait("time") as TimeTrait;
|
||||
startTimer();
|
||||
break;
|
||||
case "seek":
|
||||
seekTrait = media.getTrait("seek") as SeekTrait;
|
||||
break;
|
||||
case "play":
|
||||
playTrait = media.getTrait("play") as PlayTrait;
|
||||
}
|
||||
setupTraitEventListener(param1.traitType);
|
||||
}
|
||||
|
||||
private function onTraitRemove(param1:MediaElementEvent) : void
|
||||
{
|
||||
setupTraitEventListener(param1.traitType,false);
|
||||
switch(param1.traitType)
|
||||
{
|
||||
case "time":
|
||||
timeTrait = null;
|
||||
if(media.hasOwnProperty("numChildren") == false)
|
||||
{
|
||||
startTimer(false);
|
||||
}
|
||||
break;
|
||||
case "seek":
|
||||
seekTrait = null;
|
||||
break;
|
||||
case "play":
|
||||
playTrait = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user