Packagecom.threerings.media
Interfacepublic interface MediaPlayer extends flash.events.IEventDispatcher
SubinterfacesAudioPlayer, VideoPlayer

Implemented by media-playing backends.



Public Methods
 MethodDefined by
  
getDuration():Number
Get the duration of the media, in seconds, or NaN if not yet known.
MediaPlayer
  
getMetadata():Object
Get metadata, or null if none or not yet available.
MediaPlayer
  
getPosition():Number
Get the position of the media, in seconds, or NaN if not yet ready.
MediaPlayer
  
getState():int
MediaPlayer
  
getVolume():Number
Get the volume, from 0 to 1.
MediaPlayer
  
pause():void
Pause the media, if not already.
MediaPlayer
  
play():void
Play the media, if not already.
MediaPlayer
  
seek(position:Number):void
Seek to the specified position.
MediaPlayer
  
setVolume(volume:Number):void
Set the volume, between 0-1.
MediaPlayer
  
unload():void
Unload the media.
MediaPlayer
Events
 EventSummaryDefined by
   Dispatched when the total duration of the media is known.MediaPlayer
   Dispatched when there's a problem.MediaPlayer
   Dispatched when media metadata is available, if ever.MediaPlayer
   Dispatched periodically as the position is updated, during playback.MediaPlayer
   Dispatched when the state of the mediaplayer changes, usually in response to commands such as play/pause, etc.MediaPlayer
Method detail
getDuration()method
public function getDuration():Number

Get the duration of the media, in seconds, or NaN if not yet known.

Returns
Number
getMetadata()method 
public function getMetadata():Object

Get metadata, or null if none or not yet available. The exact format of this data object varies by MediaPlayer implementation, see the documentation for each.

Returns
Object
getPosition()method 
public function getPosition():Number

Get the position of the media, in seconds, or NaN if not yet ready.

Returns
Number
getState()method 
public function getState():int

Returns
int — a MediaPlayerCodes state constant.
getVolume()method 
public function getVolume():Number

Get the volume, from 0 to 1.

Returns
Number
pause()method 
public function pause():void

Pause the media, if not already.

play()method 
public function play():void

Play the media, if not already.

seek()method 
public function seek(position:Number):void

Seek to the specified position.

Parameters
position:Number
setVolume()method 
public function setVolume(volume:Number):void

Set the volume, between 0-1.

Parameters
volume:Number
unload()method 
public function unload():void

Unload the media.

Event detail
durationevent 
Event object type: com.threerings.util.ValueEvent

Dispatched when the total duration of the media is known. value: a Number expressing the duration in seconds.

errorevent  
Event object type: com.threerings.util.ValueEvent

Dispatched when there's a problem. value: a String error code/message.

metadataevent  
Event object type: com.threerings.util.ValueEvent

Dispatched when media metadata is available, if ever. value: metadata object.

See also

for more info.
positionevent  
Event object type: com.threerings.util.ValueEvent

Dispatched periodically as the position is updated, during playback. value: a Number expressing the position in seconds.

stateevent  
Event object type: com.threerings.util.ValueEvent

Dispatched when the state of the mediaplayer changes, usually in response to commands such as play/pause, etc. value: an int state.

See also