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, playingnew MP3Player()
static public STOP:Numberprivate _sound:Soundprivate _soundHolder:MovieClipprivate _mediaUrl:Stringprivate _recentPosition:Numberprivate _loaded:Booleanprivate _positionOnLoad:Numberprivate _listeners:Arrayprivate _volume:Numberpublic function willStop():BooleanThis is scoped public so that the MediaDisplay class can access it.
public function playStarted():VoidThis is called by the MediaDisplay object when playback starts.
public function broadcastEvent(status:String):VoidThe listeners must implement the "handlePlayer" function which takes two parameters: the slider and the current value of the slider.
public function play(startingPoint:Number):VoidPlay the media starting at the specified starting point. If the media hasn't yet been loaded, load it.
- Parameters
startingPointThe 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
aPositionTime in seconds where the playhead position should be placed
public function initializeVolume():VoidSet 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():NumberIf 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.