mx.controls.streamingmedia.AbstractPlayer +--mx.controls.streamingmedia.MP3Player
IPlayer
FLVPlayer contains the logic to play MP3 streaming media files.
_listeners
, _loaded
, _mediaUrl
, _positionOnLoad
, _recentPosition
, _sound
, _soundHolder
, _volume
, STOP
_playing
, playing
new MP3Player()
static public STOP:Number
private _sound:Sound
private _soundHolder:MovieClip
private _mediaUrl:String
private _recentPosition:Number
private _loaded:Boolean
private _positionOnLoad:Number
private _listeners:Array
private _volume:Number
public function willStop():Boolean
This is scoped public so that the MediaDisplay class can access it.
public function playStarted():Void
This is called by the MediaDisplay object when playback starts.
public function broadcastEvent(status:String):Void
The listeners must implement the "handlePlayer" function which takes two parameters: the slider and the current value of the slider.
public function play(startingPoint:Number):Void
Play the media starting at the specified starting point. If the media hasn't yet been loaded, load it.
- Parameters
startingPoint
The number of seconds into the media to start at. This is an optional parameter. If omitted, playing will occur at the current playhead position.
public function getPlayheadTime():Number
- Return
- The playhead position, measued in seconds since the start.
public function setPlayheadTime(aPosition:Number):Void
- Parameters
aPosition
Time in seconds where the playhead position should be placed
public function initializeVolume():Void
Set the volume of a new sound to the default volume.
public function getMediaBytesLoaded():Number
- Return
- The number of bytes of the media that has loaded.
public function getMediaBytesTotal():Number
- Return
- The total number of bytes of the media.
public function getTotalTime():Number
If the mp3 media has not completely loaded, then the duration property of the Sound object is not accurate. The duration property increases roughly linearly as the media loads. When the media is completely loaded, it is accurate. Hence, we can roughly calculate the total time of an mp3 by scaling the duration by the ratio of bytesTotal/bytesLoaded. In practice, this has been 95+% accurate.
- Return
- The total time of the media in seconds. For mp3 files, this is a property of the Sound object. For video, it is be a property that is manually set by the author.