mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 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,116 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import org.osmf.events.AudioEvent;
|
||||
|
||||
public class AudioTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _volume:Number = 1;
|
||||
|
||||
private var _muted:Boolean = false;
|
||||
|
||||
private var _pan:Number = 0;
|
||||
|
||||
public function AudioTrait()
|
||||
{
|
||||
super(MediaTraitType.AUDIO);
|
||||
}
|
||||
|
||||
public function get volume() : Number
|
||||
{
|
||||
return this._volume;
|
||||
}
|
||||
|
||||
final public function set volume(param1:Number) : void
|
||||
{
|
||||
if(isNaN(param1))
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
else if(param1 > 1)
|
||||
{
|
||||
param1 = 1;
|
||||
}
|
||||
else if(param1 < 0)
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
if(param1 != this._volume)
|
||||
{
|
||||
this.volumeChangeStart(param1);
|
||||
this._volume = param1;
|
||||
this.volumeChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public function get muted() : Boolean
|
||||
{
|
||||
return this._muted;
|
||||
}
|
||||
|
||||
final public function set muted(param1:Boolean) : void
|
||||
{
|
||||
if(param1 != this._muted)
|
||||
{
|
||||
this.mutedChangeStart(param1);
|
||||
this._muted = param1;
|
||||
this.mutedChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public function get pan() : Number
|
||||
{
|
||||
return this._pan;
|
||||
}
|
||||
|
||||
final public function set pan(param1:Number) : void
|
||||
{
|
||||
if(isNaN(param1))
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
else if(param1 > 1)
|
||||
{
|
||||
param1 = 1;
|
||||
}
|
||||
else if(param1 < -1)
|
||||
{
|
||||
param1 = -1;
|
||||
}
|
||||
if(param1 != this._pan)
|
||||
{
|
||||
this.panChangeStart(param1);
|
||||
this._pan = param1;
|
||||
this.panChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
protected function volumeChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function volumeChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new AudioEvent(AudioEvent.VOLUME_CHANGE,false,false,false,this._volume));
|
||||
}
|
||||
|
||||
protected function mutedChangeStart(param1:Boolean) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function mutedChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new AudioEvent(AudioEvent.MUTED_CHANGE,false,false,this._muted));
|
||||
}
|
||||
|
||||
protected function panChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function panChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new AudioEvent(AudioEvent.PAN_CHANGE,false,false,false,NaN,this._pan));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import org.osmf.events.BufferEvent;
|
||||
|
||||
public class BufferTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _buffering:Boolean = false;
|
||||
|
||||
private var _bufferLength:Number = 0;
|
||||
|
||||
private var _bufferTime:Number = 0;
|
||||
|
||||
public function BufferTrait()
|
||||
{
|
||||
super(MediaTraitType.BUFFER);
|
||||
}
|
||||
|
||||
public function get buffering() : Boolean
|
||||
{
|
||||
return this._buffering;
|
||||
}
|
||||
|
||||
public function get bufferLength() : Number
|
||||
{
|
||||
return this._bufferLength;
|
||||
}
|
||||
|
||||
public function get bufferTime() : Number
|
||||
{
|
||||
return this._bufferTime;
|
||||
}
|
||||
|
||||
public function set bufferTime(param1:Number) : void
|
||||
{
|
||||
if(isNaN(param1) || param1 < 0)
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
if(param1 != this._bufferTime)
|
||||
{
|
||||
this.bufferTimeChangeStart(param1);
|
||||
this._bufferTime = param1;
|
||||
this.bufferTimeChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setBufferLength(param1:Number) : void
|
||||
{
|
||||
if(param1 != this._bufferLength)
|
||||
{
|
||||
this.bufferLengthChangeStart(param1);
|
||||
this._bufferLength = param1;
|
||||
this.bufferLengthChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setBuffering(param1:Boolean) : void
|
||||
{
|
||||
if(param1 != this._buffering)
|
||||
{
|
||||
this.bufferingChangeStart(param1);
|
||||
this._buffering = param1;
|
||||
this.bufferingChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
protected function bufferingChangeStart(param1:Boolean) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bufferingChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new BufferEvent(BufferEvent.BUFFERING_CHANGE,false,false,this._buffering));
|
||||
}
|
||||
|
||||
protected function bufferLengthChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bufferLengthChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new BufferEvent(BufferEvent.BUFFER_LENGTH_CHANGE,false,false,false,NaN,this._bufferLength));
|
||||
}
|
||||
|
||||
protected function bufferTimeChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bufferTimeChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new BufferEvent(BufferEvent.BUFFER_TIME_CHANGE,false,false,false,this._bufferTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
public final class DRMState
|
||||
{
|
||||
|
||||
public static const UNINITIALIZED:String = "uninitialized";
|
||||
|
||||
public static const AUTHENTICATION_NEEDED:String = "authenticationNeeded";
|
||||
|
||||
public static const AUTHENTICATING:String = "authenticating";
|
||||
|
||||
public static const AUTHENTICATION_COMPLETE:String = "authenticationComplete";
|
||||
|
||||
public static const AUTHENTICATION_ERROR:String = "authenticationError";
|
||||
|
||||
public static const DRM_SYSTEM_UPDATING:String = "drmSystemUpdating";
|
||||
|
||||
public function DRMState()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
public class DRMTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _drmState:String = "uninitialized";
|
||||
|
||||
private var _period:Number = 0;
|
||||
|
||||
private var _endDate:Date;
|
||||
|
||||
private var _startDate:Date;
|
||||
|
||||
public function DRMTrait()
|
||||
{
|
||||
super(MediaTraitType.DRM);
|
||||
}
|
||||
|
||||
public function authenticate(param1:String = null, param2:String = null) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function authenticateWithToken(param1:Object) : void
|
||||
{
|
||||
}
|
||||
|
||||
public function get drmState() : String
|
||||
{
|
||||
return this._drmState;
|
||||
}
|
||||
|
||||
public function get startDate() : Date
|
||||
{
|
||||
return this._startDate;
|
||||
}
|
||||
|
||||
public function get endDate() : Date
|
||||
{
|
||||
return this._endDate;
|
||||
}
|
||||
|
||||
public function get period() : Number
|
||||
{
|
||||
return this._period;
|
||||
}
|
||||
|
||||
final protected function setPeriod(param1:Number) : void
|
||||
{
|
||||
this._period = param1;
|
||||
}
|
||||
|
||||
final protected function setStartDate(param1:Date) : void
|
||||
{
|
||||
this._startDate = param1;
|
||||
}
|
||||
|
||||
final protected function setEndDate(param1:Date) : void
|
||||
{
|
||||
this._endDate = param1;
|
||||
}
|
||||
|
||||
final protected function setDrmState(param1:String) : void
|
||||
{
|
||||
this._drmState = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import org.osmf.events.DVREvent;
|
||||
|
||||
public class DVRTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _isRecording:Boolean;
|
||||
|
||||
public function DVRTrait(param1:Boolean = false)
|
||||
{
|
||||
this._isRecording = param1;
|
||||
super(MediaTraitType.DVR);
|
||||
}
|
||||
|
||||
final public function get isRecording() : Boolean
|
||||
{
|
||||
return this._isRecording;
|
||||
}
|
||||
|
||||
final protected function setIsRecording(param1:Boolean) : void
|
||||
{
|
||||
if(param1 != this._isRecording)
|
||||
{
|
||||
this.isRecordingChangeStart(param1);
|
||||
this._isRecording = param1;
|
||||
this.isRecordingChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
protected function isRecordingChangeStart(param1:Boolean) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function isRecordingChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new DVREvent(DVREvent.IS_RECORDING_CHANGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
|
||||
public class DisplayObjectTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _displayObject:DisplayObject;
|
||||
|
||||
private var _mediaWidth:Number = 0;
|
||||
|
||||
private var _mediaHeight:Number = 0;
|
||||
|
||||
public function DisplayObjectTrait(param1:DisplayObject, param2:Number = 0, param3:Number = 0)
|
||||
{
|
||||
super(MediaTraitType.DISPLAY_OBJECT);
|
||||
this._displayObject = param1;
|
||||
this._mediaWidth = param2;
|
||||
this._mediaHeight = param3;
|
||||
}
|
||||
|
||||
public function get displayObject() : DisplayObject
|
||||
{
|
||||
return this._displayObject;
|
||||
}
|
||||
|
||||
public function get mediaWidth() : Number
|
||||
{
|
||||
return this._mediaWidth;
|
||||
}
|
||||
|
||||
public function get mediaHeight() : Number
|
||||
{
|
||||
return this._mediaHeight;
|
||||
}
|
||||
|
||||
final protected function setDisplayObject(param1:DisplayObject) : void
|
||||
{
|
||||
var _loc2_:DisplayObject = null;
|
||||
if(this._displayObject != param1)
|
||||
{
|
||||
this.displayObjectChangeStart(param1);
|
||||
_loc2_ = this._displayObject;
|
||||
this._displayObject = param1;
|
||||
this.displayObjectChangeEnd(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setMediaSize(param1:Number, param2:Number) : void
|
||||
{
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc4_:Number = NaN;
|
||||
if(param1 != this._mediaWidth || param2 != this._mediaHeight)
|
||||
{
|
||||
this.mediaSizeChangeStart(param1,param2);
|
||||
_loc3_ = this._mediaWidth;
|
||||
_loc4_ = this._mediaHeight;
|
||||
this._mediaWidth = param1;
|
||||
this._mediaHeight = param2;
|
||||
this.mediaSizeChangeEnd(_loc3_,_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
protected function displayObjectChangeStart(param1:DisplayObject) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function displayObjectChangeEnd(param1:DisplayObject) : void
|
||||
{
|
||||
dispatchEvent(new DisplayObjectEvent(DisplayObjectEvent.DISPLAY_OBJECT_CHANGE,false,false,param1,this._displayObject));
|
||||
}
|
||||
|
||||
protected function mediaSizeChangeStart(param1:Number, param2:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function mediaSizeChangeEnd(param1:Number, param2:Number) : void
|
||||
{
|
||||
dispatchEvent(new DisplayObjectEvent(DisplayObjectEvent.MEDIA_SIZE_CHANGE,false,false,null,null,param1,param2,this._mediaWidth,this._mediaHeight));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.errors.IllegalOperationError;
|
||||
import org.osmf.events.DynamicStreamEvent;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class DynamicStreamTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _autoSwitch:Boolean;
|
||||
|
||||
private var _currentIndex:int = 0;
|
||||
|
||||
private var _maxAllowedIndex:int = 0;
|
||||
|
||||
private var _numDynamicStreams:int;
|
||||
|
||||
private var _switching:Boolean;
|
||||
|
||||
public function DynamicStreamTrait(param1:Boolean = true, param2:int = 0, param3:int = 1)
|
||||
{
|
||||
super(MediaTraitType.DYNAMIC_STREAM);
|
||||
this._autoSwitch = param1;
|
||||
this._currentIndex = param2;
|
||||
this._numDynamicStreams = param3;
|
||||
this._maxAllowedIndex = param3 - 1;
|
||||
this._switching = false;
|
||||
}
|
||||
|
||||
public function get autoSwitch() : Boolean
|
||||
{
|
||||
return this._autoSwitch;
|
||||
}
|
||||
|
||||
final public function set autoSwitch(param1:Boolean) : void
|
||||
{
|
||||
if(this.autoSwitch != param1)
|
||||
{
|
||||
this.autoSwitchChangeStart(param1);
|
||||
this._autoSwitch = param1;
|
||||
this.autoSwitchChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public function get numDynamicStreams() : int
|
||||
{
|
||||
return this._numDynamicStreams;
|
||||
}
|
||||
|
||||
public function get currentIndex() : int
|
||||
{
|
||||
return this._currentIndex;
|
||||
}
|
||||
|
||||
public function get maxAllowedIndex() : int
|
||||
{
|
||||
return this._maxAllowedIndex;
|
||||
}
|
||||
|
||||
final public function set maxAllowedIndex(param1:int) : void
|
||||
{
|
||||
if(param1 < 0 || param1 > this._numDynamicStreams - 1)
|
||||
{
|
||||
throw new RangeError(OSMFStrings.getString(OSMFStrings.STREAMSWITCH_INVALID_INDEX));
|
||||
}
|
||||
if(this.maxAllowedIndex != param1)
|
||||
{
|
||||
this.maxAllowedIndexChangeStart(param1);
|
||||
this._maxAllowedIndex = param1;
|
||||
this.maxAllowedIndexChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public function getBitrateForIndex(param1:int) : Number
|
||||
{
|
||||
if(param1 > this._numDynamicStreams - 1 || param1 < 0)
|
||||
{
|
||||
throw new RangeError(OSMFStrings.getString(OSMFStrings.STREAMSWITCH_INVALID_INDEX));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get switching() : Boolean
|
||||
{
|
||||
return this._switching;
|
||||
}
|
||||
|
||||
public function switchTo(param1:int) : void
|
||||
{
|
||||
if(this.autoSwitch)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.STREAMSWITCH_STREAM_NOT_IN_MANUAL_MODE));
|
||||
}
|
||||
if(param1 != this.currentIndex)
|
||||
{
|
||||
if(param1 < 0 || param1 > this.maxAllowedIndex)
|
||||
{
|
||||
throw new RangeError(OSMFStrings.getString(OSMFStrings.STREAMSWITCH_INVALID_INDEX));
|
||||
}
|
||||
this.setSwitching(true,param1);
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setNumDynamicStreams(param1:int) : void
|
||||
{
|
||||
if(param1 != this._numDynamicStreams)
|
||||
{
|
||||
this._numDynamicStreams = param1;
|
||||
if(this.maxAllowedIndex >= this._numDynamicStreams)
|
||||
{
|
||||
this.maxAllowedIndex = Math.max(0,this._numDynamicStreams - 1);
|
||||
}
|
||||
dispatchEvent(new DynamicStreamEvent(DynamicStreamEvent.NUM_DYNAMIC_STREAMS_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setCurrentIndex(param1:int) : void
|
||||
{
|
||||
this._currentIndex = param1;
|
||||
}
|
||||
|
||||
final protected function setSwitching(param1:Boolean, param2:int) : void
|
||||
{
|
||||
if(param1 != this._switching)
|
||||
{
|
||||
this.switchingChangeStart(param1,param2);
|
||||
this._switching = param1;
|
||||
if(param1 == false)
|
||||
{
|
||||
this.setCurrentIndex(param2);
|
||||
}
|
||||
this.switchingChangeEnd(param2);
|
||||
}
|
||||
}
|
||||
|
||||
protected function autoSwitchChangeStart(param1:Boolean) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function autoSwitchChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new DynamicStreamEvent(DynamicStreamEvent.AUTO_SWITCH_CHANGE,false,false,false,this._autoSwitch));
|
||||
}
|
||||
|
||||
protected function switchingChangeStart(param1:Boolean, param2:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function switchingChangeEnd(param1:int) : void
|
||||
{
|
||||
dispatchEvent(new DynamicStreamEvent(DynamicStreamEvent.SWITCHING_CHANGE,false,false,this.switching));
|
||||
}
|
||||
|
||||
protected function maxAllowedIndexChangeStart(param1:int) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function maxAllowedIndexChangeEnd() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
public final class LoadState
|
||||
{
|
||||
|
||||
public static const UNINITIALIZED:String = "uninitialized";
|
||||
|
||||
public static const LOADING:String = "loading";
|
||||
|
||||
public static const UNLOADING:String = "unloading";
|
||||
|
||||
public static const READY:String = "ready";
|
||||
|
||||
public static const LOAD_ERROR:String = "loadError";
|
||||
|
||||
public function LoadState()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.errors.IllegalOperationError;
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.events.LoaderEvent;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class LoadTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var loader:LoaderBase;
|
||||
|
||||
private var _resource:MediaResourceBase;
|
||||
|
||||
private var _loadState:String;
|
||||
|
||||
private var _bytesLoaded:Number;
|
||||
|
||||
private var _bytesTotal:Number;
|
||||
|
||||
public function LoadTrait(param1:LoaderBase, param2:MediaResourceBase)
|
||||
{
|
||||
super(MediaTraitType.LOAD);
|
||||
this.loader = param1;
|
||||
this._resource = param2;
|
||||
this._loadState = LoadState.UNINITIALIZED;
|
||||
if(param1 != null)
|
||||
{
|
||||
param1.addEventListener(LoaderEvent.LOAD_STATE_CHANGE,this.onLoadStateChange,false,int.MAX_VALUE,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function get resource() : MediaResourceBase
|
||||
{
|
||||
return this._resource;
|
||||
}
|
||||
|
||||
public function get loadState() : String
|
||||
{
|
||||
return this._loadState;
|
||||
}
|
||||
|
||||
public function load() : void
|
||||
{
|
||||
if(this.loader)
|
||||
{
|
||||
if(this._loadState == LoadState.READY)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_READY));
|
||||
}
|
||||
if(this._loadState == LoadState.LOADING)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_LOADING));
|
||||
}
|
||||
this.loader.load(this);
|
||||
return;
|
||||
}
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.MUST_SET_LOADER));
|
||||
}
|
||||
|
||||
public function unload() : void
|
||||
{
|
||||
if(this.loader)
|
||||
{
|
||||
if(this._loadState == LoadState.UNLOADING)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_UNLOADING));
|
||||
}
|
||||
if(this._loadState == LoadState.UNINITIALIZED)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_UNLOADED));
|
||||
}
|
||||
this.loader.unload(this);
|
||||
return;
|
||||
}
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.MUST_SET_LOADER));
|
||||
}
|
||||
|
||||
public function get bytesLoaded() : Number
|
||||
{
|
||||
return this._bytesLoaded;
|
||||
}
|
||||
|
||||
public function get bytesTotal() : Number
|
||||
{
|
||||
return this._bytesTotal;
|
||||
}
|
||||
|
||||
final protected function setLoadState(param1:String) : void
|
||||
{
|
||||
if(this._loadState != param1)
|
||||
{
|
||||
this.loadStateChangeStart(param1);
|
||||
this._loadState = param1;
|
||||
this.loadStateChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setBytesLoaded(param1:Number) : void
|
||||
{
|
||||
if(isNaN(param1) || param1 > this.bytesTotal || param1 < 0)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
if(param1 != this._bytesLoaded)
|
||||
{
|
||||
this.bytesLoadedChangeStart(param1);
|
||||
this._bytesLoaded = param1;
|
||||
this.bytesLoadedChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setBytesTotal(param1:Number) : void
|
||||
{
|
||||
if(param1 < this._bytesLoaded || param1 < 0)
|
||||
{
|
||||
throw new ArgumentError(OSMFStrings.getString(OSMFStrings.INVALID_PARAM));
|
||||
}
|
||||
if(param1 != this._bytesTotal)
|
||||
{
|
||||
this.bytesTotalChangeStart(param1);
|
||||
this._bytesTotal = param1;
|
||||
this.bytesTotalChangeEnd();
|
||||
}
|
||||
}
|
||||
|
||||
protected function bytesLoadedChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bytesLoadedChangeEnd() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bytesTotalChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function bytesTotalChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new LoadEvent(LoadEvent.BYTES_TOTAL_CHANGE,false,false,null,this._bytesTotal));
|
||||
}
|
||||
|
||||
protected function loadStateChangeStart(param1:String) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function loadStateChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new LoadEvent(LoadEvent.LOAD_STATE_CHANGE,false,false,this._loadState));
|
||||
}
|
||||
|
||||
private function onLoadStateChange(param1:LoaderEvent) : void
|
||||
{
|
||||
if(param1.loadTrait == this)
|
||||
{
|
||||
this.setLoadState(param1.newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.errors.IllegalOperationError;
|
||||
import flash.events.EventDispatcher;
|
||||
import org.osmf.events.LoaderEvent;
|
||||
import org.osmf.media.MediaResourceBase;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class LoaderBase extends EventDispatcher
|
||||
{
|
||||
|
||||
public function LoaderBase()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function canHandleResource(param1:MediaResourceBase) : Boolean
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final public function load(param1:LoadTrait) : void
|
||||
{
|
||||
this.validateLoad(param1);
|
||||
this.executeLoad(param1);
|
||||
}
|
||||
|
||||
final public function unload(param1:LoadTrait) : void
|
||||
{
|
||||
this.validateUnload(param1);
|
||||
this.executeUnload(param1);
|
||||
}
|
||||
|
||||
protected function executeLoad(param1:LoadTrait) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function executeUnload(param1:LoadTrait) : void
|
||||
{
|
||||
}
|
||||
|
||||
final protected function updateLoadTrait(param1:LoadTrait, param2:String) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
if(param2 != param1.loadState)
|
||||
{
|
||||
_loc3_ = param1.loadState;
|
||||
dispatchEvent(new LoaderEvent(LoaderEvent.LOAD_STATE_CHANGE,false,false,this,param1,_loc3_,param2));
|
||||
}
|
||||
}
|
||||
|
||||
private function validateLoad(param1:LoadTrait) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(param1.loadState == LoadState.READY)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_READY));
|
||||
}
|
||||
if(param1.loadState == LoadState.LOADING)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_LOADING));
|
||||
}
|
||||
if(this.canHandleResource(param1.resource) == false)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.LOADER_CANT_HANDLE_RESOURCE));
|
||||
}
|
||||
}
|
||||
|
||||
private function validateUnload(param1:LoadTrait) : void
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.NULL_PARAM));
|
||||
}
|
||||
if(param1.loadState == LoadState.UNLOADING)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_UNLOADING));
|
||||
}
|
||||
if(param1.loadState == LoadState.UNINITIALIZED)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.ALREADY_UNLOADED));
|
||||
}
|
||||
if(this.canHandleResource(param1.resource) == false)
|
||||
{
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.LOADER_CANT_HANDLE_RESOURCE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.events.EventDispatcher;
|
||||
|
||||
public class MediaTraitBase extends EventDispatcher
|
||||
{
|
||||
|
||||
private var _traitType:String;
|
||||
|
||||
public function MediaTraitBase(param1:String)
|
||||
{
|
||||
super();
|
||||
this._traitType = param1;
|
||||
}
|
||||
|
||||
public function get traitType() : String
|
||||
{
|
||||
return this._traitType;
|
||||
}
|
||||
|
||||
public function dispose() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
public final class MediaTraitType
|
||||
{
|
||||
|
||||
public static const AUDIO:String = "audio";
|
||||
|
||||
public static const BUFFER:String = "buffer";
|
||||
|
||||
public static const DRM:String = "drm";
|
||||
|
||||
public static const DYNAMIC_STREAM:String = "dynamicStream";
|
||||
|
||||
public static const LOAD:String = "load";
|
||||
|
||||
public static const PLAY:String = "play";
|
||||
|
||||
public static const SEEK:String = "seek";
|
||||
|
||||
public static const TIME:String = "time";
|
||||
|
||||
public static const DISPLAY_OBJECT:String = "displayObject";
|
||||
|
||||
public static const DVR:String = "dvr";
|
||||
|
||||
public static const ALL_TYPES:Vector.<String> = Vector.<String>([AUDIO,BUFFER,DRM,DYNAMIC_STREAM,LOAD,PLAY,SEEK,TIME,DISPLAY_OBJECT,DVR]);
|
||||
|
||||
public function MediaTraitType()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
public final class PlayState
|
||||
{
|
||||
|
||||
public static const PLAYING:String = "playing";
|
||||
|
||||
public static const PAUSED:String = "paused";
|
||||
|
||||
public static const STOPPED:String = "stopped";
|
||||
|
||||
public function PlayState()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.errors.IllegalOperationError;
|
||||
import org.osmf.events.PlayEvent;
|
||||
import org.osmf.utils.OSMFStrings;
|
||||
|
||||
public class PlayTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _playState:String;
|
||||
|
||||
private var _canPause:Boolean;
|
||||
|
||||
public function PlayTrait()
|
||||
{
|
||||
super(MediaTraitType.PLAY);
|
||||
this._canPause = true;
|
||||
this._playState = PlayState.STOPPED;
|
||||
}
|
||||
|
||||
final public function play() : void
|
||||
{
|
||||
this.attemptPlayStateChange(PlayState.PLAYING);
|
||||
}
|
||||
|
||||
public function get canPause() : Boolean
|
||||
{
|
||||
return this._canPause;
|
||||
}
|
||||
|
||||
final public function pause() : void
|
||||
{
|
||||
if(this.canPause)
|
||||
{
|
||||
this.attemptPlayStateChange(PlayState.PAUSED);
|
||||
return;
|
||||
}
|
||||
throw new IllegalOperationError(OSMFStrings.getString(OSMFStrings.PAUSE_NOT_SUPPORTED));
|
||||
}
|
||||
|
||||
final public function stop() : void
|
||||
{
|
||||
this.attemptPlayStateChange(PlayState.STOPPED);
|
||||
}
|
||||
|
||||
public function get playState() : String
|
||||
{
|
||||
return this._playState;
|
||||
}
|
||||
|
||||
final protected function setCanPause(param1:Boolean) : void
|
||||
{
|
||||
if(param1 != this._canPause)
|
||||
{
|
||||
this._canPause = param1;
|
||||
dispatchEvent(new PlayEvent(PlayEvent.CAN_PAUSE_CHANGE));
|
||||
}
|
||||
}
|
||||
|
||||
protected function playStateChangeStart(param1:String) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function playStateChangeEnd() : void
|
||||
{
|
||||
dispatchEvent(new PlayEvent(PlayEvent.PLAY_STATE_CHANGE,false,false,this.playState));
|
||||
}
|
||||
|
||||
private function attemptPlayStateChange(param1:String) : void
|
||||
{
|
||||
if(this._playState != param1)
|
||||
{
|
||||
this.playStateChangeStart(param1);
|
||||
this._playState = param1;
|
||||
this.playStateChangeEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import org.osmf.events.SeekEvent;
|
||||
|
||||
public class SeekTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _timeTrait:TimeTrait;
|
||||
|
||||
private var _seeking:Boolean;
|
||||
|
||||
public function SeekTrait(param1:TimeTrait)
|
||||
{
|
||||
super(MediaTraitType.SEEK);
|
||||
this._timeTrait = param1;
|
||||
}
|
||||
|
||||
final public function get seeking() : Boolean
|
||||
{
|
||||
return this._seeking;
|
||||
}
|
||||
|
||||
final public function seek(param1:Number) : void
|
||||
{
|
||||
if(this.canSeekTo(param1))
|
||||
{
|
||||
this.setSeeking(true,param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function canSeekTo(param1:Number) : Boolean
|
||||
{
|
||||
return this._timeTrait ? isNaN(param1) == false && param1 >= 0 && (param1 <= this._timeTrait.duration || param1 <= this._timeTrait.currentTime) : false;
|
||||
}
|
||||
|
||||
final protected function get timeTrait() : TimeTrait
|
||||
{
|
||||
return this._timeTrait;
|
||||
}
|
||||
|
||||
final protected function set timeTrait(param1:TimeTrait) : void
|
||||
{
|
||||
this._timeTrait = param1;
|
||||
}
|
||||
|
||||
final protected function setSeeking(param1:Boolean, param2:Number) : void
|
||||
{
|
||||
this.seekingChangeStart(param1,param2);
|
||||
this._seeking = param1;
|
||||
this.seekingChangeEnd(param2);
|
||||
}
|
||||
|
||||
protected function seekingChangeStart(param1:Boolean, param2:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function seekingChangeEnd(param1:Number) : void
|
||||
{
|
||||
dispatchEvent(new SeekEvent(SeekEvent.SEEKING_CHANGE,false,false,this.seeking,param1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import org.osmf.events.TimeEvent;
|
||||
|
||||
public class TimeTrait extends MediaTraitBase
|
||||
{
|
||||
|
||||
private var _duration:Number;
|
||||
|
||||
private var _currentTime:Number;
|
||||
|
||||
public function TimeTrait(param1:Number = NaN)
|
||||
{
|
||||
super(MediaTraitType.TIME);
|
||||
this._duration = param1;
|
||||
}
|
||||
|
||||
public function get duration() : Number
|
||||
{
|
||||
return this._duration;
|
||||
}
|
||||
|
||||
public function get currentTime() : Number
|
||||
{
|
||||
return this._currentTime;
|
||||
}
|
||||
|
||||
protected function durationChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function durationChangeEnd(param1:Number) : void
|
||||
{
|
||||
dispatchEvent(new TimeEvent(TimeEvent.DURATION_CHANGE,false,false,this._duration));
|
||||
}
|
||||
|
||||
protected function currentTimeChangeStart(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function currentTimeChangeEnd(param1:Number) : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function signalComplete() : void
|
||||
{
|
||||
dispatchEvent(new TimeEvent(TimeEvent.COMPLETE));
|
||||
}
|
||||
|
||||
final protected function setCurrentTime(param1:Number) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
if(!isNaN(param1))
|
||||
{
|
||||
if(!isNaN(this._duration))
|
||||
{
|
||||
param1 = Math.min(param1,this._duration);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
}
|
||||
if(this._currentTime != param1 && !(isNaN(this._currentTime) && isNaN(param1)))
|
||||
{
|
||||
this.currentTimeChangeStart(param1);
|
||||
_loc2_ = this._currentTime;
|
||||
this._currentTime = param1;
|
||||
this.currentTimeChangeEnd(_loc2_);
|
||||
if(this.currentTime == this.duration && this.currentTime > 0)
|
||||
{
|
||||
this.signalComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final protected function setDuration(param1:Number) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
if(this._duration != param1)
|
||||
{
|
||||
this.durationChangeStart(param1);
|
||||
_loc2_ = this._duration;
|
||||
this._duration = param1;
|
||||
this.durationChangeEnd(_loc2_);
|
||||
if(!isNaN(this._currentTime) && !isNaN(this._duration) && this._currentTime > this._duration)
|
||||
{
|
||||
this.setCurrentTime(this.duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
package org.osmf.traits
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import org.osmf.events.AudioEvent;
|
||||
import org.osmf.events.BufferEvent;
|
||||
import org.osmf.events.DRMEvent;
|
||||
import org.osmf.events.DVREvent;
|
||||
import org.osmf.events.DisplayObjectEvent;
|
||||
import org.osmf.events.DynamicStreamEvent;
|
||||
import org.osmf.events.LoadEvent;
|
||||
import org.osmf.events.MediaElementEvent;
|
||||
import org.osmf.events.PlayEvent;
|
||||
import org.osmf.events.SeekEvent;
|
||||
import org.osmf.events.TimeEvent;
|
||||
import org.osmf.media.MediaElement;
|
||||
|
||||
public class TraitEventDispatcher extends EventDispatcher
|
||||
{
|
||||
|
||||
private static var eventMaps:Dictionary;
|
||||
|
||||
private var _mediaElement:MediaElement;
|
||||
|
||||
public function TraitEventDispatcher()
|
||||
{
|
||||
super();
|
||||
if(eventMaps == null)
|
||||
{
|
||||
eventMaps = new Dictionary();
|
||||
eventMaps[TimeEvent.DURATION_CHANGE] = MediaTraitType.TIME;
|
||||
eventMaps[TimeEvent.COMPLETE] = MediaTraitType.TIME;
|
||||
eventMaps[PlayEvent.PLAY_STATE_CHANGE] = MediaTraitType.PLAY;
|
||||
eventMaps[PlayEvent.CAN_PAUSE_CHANGE] = MediaTraitType.PLAY;
|
||||
eventMaps[AudioEvent.VOLUME_CHANGE] = MediaTraitType.AUDIO;
|
||||
eventMaps[AudioEvent.MUTED_CHANGE] = MediaTraitType.AUDIO;
|
||||
eventMaps[AudioEvent.PAN_CHANGE] = MediaTraitType.AUDIO;
|
||||
eventMaps[SeekEvent.SEEKING_CHANGE] = MediaTraitType.SEEK;
|
||||
eventMaps[DynamicStreamEvent.SWITCHING_CHANGE] = MediaTraitType.DYNAMIC_STREAM;
|
||||
eventMaps[DynamicStreamEvent.AUTO_SWITCH_CHANGE] = MediaTraitType.DYNAMIC_STREAM;
|
||||
eventMaps[DynamicStreamEvent.NUM_DYNAMIC_STREAMS_CHANGE] = MediaTraitType.DYNAMIC_STREAM;
|
||||
eventMaps[DisplayObjectEvent.DISPLAY_OBJECT_CHANGE] = MediaTraitType.DISPLAY_OBJECT;
|
||||
eventMaps[DisplayObjectEvent.MEDIA_SIZE_CHANGE] = MediaTraitType.DISPLAY_OBJECT;
|
||||
eventMaps[LoadEvent.LOAD_STATE_CHANGE] = MediaTraitType.LOAD;
|
||||
eventMaps[LoadEvent.BYTES_LOADED_CHANGE] = MediaTraitType.LOAD;
|
||||
eventMaps[LoadEvent.BYTES_TOTAL_CHANGE] = MediaTraitType.LOAD;
|
||||
eventMaps[BufferEvent.BUFFERING_CHANGE] = MediaTraitType.BUFFER;
|
||||
eventMaps[BufferEvent.BUFFER_TIME_CHANGE] = MediaTraitType.BUFFER;
|
||||
eventMaps[BufferEvent.BUFFER_LENGTH_CHANGE] = MediaTraitType.BUFFER;
|
||||
eventMaps[DRMEvent.DRM_STATE_CHANGE] = MediaTraitType.DRM;
|
||||
eventMaps[DVREvent.IS_RECORDING_CHANGE] = MediaTraitType.DVR;
|
||||
}
|
||||
}
|
||||
|
||||
public function get media() : MediaElement
|
||||
{
|
||||
return this._mediaElement;
|
||||
}
|
||||
|
||||
public function set media(param1:MediaElement) : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
if(param1 != this._mediaElement)
|
||||
{
|
||||
if(this._mediaElement != null)
|
||||
{
|
||||
this._mediaElement.removeEventListener(MediaElementEvent.TRAIT_ADD,this.onTraitAdd);
|
||||
this._mediaElement.removeEventListener(MediaElementEvent.TRAIT_REMOVE,this.onTraitRemove);
|
||||
for each(_loc2_ in this._mediaElement.traitTypes)
|
||||
{
|
||||
this.onTraitChanged(_loc2_,false);
|
||||
}
|
||||
}
|
||||
this._mediaElement = param1;
|
||||
if(this._mediaElement != null)
|
||||
{
|
||||
this._mediaElement.addEventListener(MediaElementEvent.TRAIT_ADD,this.onTraitAdd);
|
||||
this._mediaElement.addEventListener(MediaElementEvent.TRAIT_REMOVE,this.onTraitRemove);
|
||||
for each(_loc2_ in this._mediaElement.traitTypes)
|
||||
{
|
||||
this.onTraitChanged(_loc2_,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function addEventListener(param1:String, param2:Function, param3:Boolean = false, param4:int = 0, param5:Boolean = false) : void
|
||||
{
|
||||
var _loc6_:Boolean = hasEventListener(param1);
|
||||
super.addEventListener(param1,param2,param3,param4,param5);
|
||||
if(Boolean(this._mediaElement) && Boolean(!_loc6_) && eventMaps[param1] != undefined)
|
||||
{
|
||||
this.changeListeners(true,eventMaps[param1],param1);
|
||||
}
|
||||
}
|
||||
|
||||
override public function removeEventListener(param1:String, param2:Function, param3:Boolean = false) : void
|
||||
{
|
||||
super.removeEventListener(param1,param2,param3);
|
||||
if(Boolean(this._mediaElement) && Boolean(!hasEventListener(param1)) && eventMaps[param1] != undefined)
|
||||
{
|
||||
this.changeListeners(false,eventMaps[param1],param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onTraitAdd(param1:MediaElementEvent) : void
|
||||
{
|
||||
this.onTraitChanged(param1.traitType,true);
|
||||
}
|
||||
|
||||
private function onTraitRemove(param1:MediaElementEvent) : void
|
||||
{
|
||||
this.onTraitChanged(param1.traitType,false);
|
||||
}
|
||||
|
||||
private function onTraitChanged(param1:String, param2:Boolean) : void
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case MediaTraitType.TIME:
|
||||
this.changeListeners(param2,param1,TimeEvent.DURATION_CHANGE);
|
||||
this.changeListeners(param2,param1,TimeEvent.COMPLETE);
|
||||
break;
|
||||
case MediaTraitType.PLAY:
|
||||
this.changeListeners(param2,param1,PlayEvent.PLAY_STATE_CHANGE);
|
||||
this.changeListeners(param2,param1,PlayEvent.CAN_PAUSE_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.AUDIO:
|
||||
this.changeListeners(param2,param1,AudioEvent.VOLUME_CHANGE);
|
||||
this.changeListeners(param2,param1,AudioEvent.MUTED_CHANGE);
|
||||
this.changeListeners(param2,param1,AudioEvent.PAN_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.SEEK:
|
||||
this.changeListeners(param2,param1,SeekEvent.SEEKING_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.DYNAMIC_STREAM:
|
||||
this.changeListeners(param2,param1,DynamicStreamEvent.SWITCHING_CHANGE);
|
||||
this.changeListeners(param2,param1,DynamicStreamEvent.AUTO_SWITCH_CHANGE);
|
||||
this.changeListeners(param2,param1,DynamicStreamEvent.NUM_DYNAMIC_STREAMS_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.DISPLAY_OBJECT:
|
||||
this.changeListeners(param2,param1,DisplayObjectEvent.DISPLAY_OBJECT_CHANGE);
|
||||
this.changeListeners(param2,param1,DisplayObjectEvent.MEDIA_SIZE_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.LOAD:
|
||||
this.changeListeners(param2,param1,LoadEvent.LOAD_STATE_CHANGE);
|
||||
this.changeListeners(param2,param1,LoadEvent.BYTES_TOTAL_CHANGE);
|
||||
this.changeListeners(param2,param1,LoadEvent.BYTES_LOADED_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.BUFFER:
|
||||
this.changeListeners(param2,param1,BufferEvent.BUFFERING_CHANGE);
|
||||
this.changeListeners(param2,param1,BufferEvent.BUFFER_TIME_CHANGE);
|
||||
this.changeListeners(param2,param1,BufferEvent.BUFFER_LENGTH_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.DRM:
|
||||
this.changeListeners(param2,param1,DRMEvent.DRM_STATE_CHANGE);
|
||||
break;
|
||||
case MediaTraitType.DVR:
|
||||
this.changeListeners(param2,param1,DVREvent.IS_RECORDING_CHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
private function changeListeners(param1:Boolean, param2:String, param3:String) : void
|
||||
{
|
||||
if(this._mediaElement.getTrait(param2) != null)
|
||||
{
|
||||
if(param1 && hasEventListener(param3))
|
||||
{
|
||||
this._mediaElement.getTrait(param2).addEventListener(param3,this.redispatchEvent);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._mediaElement.getTrait(param2).removeEventListener(param3,this.redispatchEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function redispatchEvent(param1:Event) : void
|
||||
{
|
||||
dispatchEvent(param1.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user