| Package | com.threerings.media |
| Interface | public interface MediaPlayer extends flash.events.IEventDispatcher |
| Subinterfaces | AudioPlayer, VideoPlayer |
| Method | Defined 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 | ||
| Event | Summary | Defined 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 | |||
| getDuration | () | method |
public function getDuration():NumberGet the duration of the media, in seconds, or NaN if not yet known.
ReturnsNumber |
| getMetadata | () | method |
public function getMetadata():ObjectGet 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.
ReturnsObject |
| getPosition | () | method |
public function getPosition():NumberGet the position of the media, in seconds, or NaN if not yet ready.
ReturnsNumber |
| getState | () | method |
public function getState():intReturns
int — a MediaPlayerCodes state constant.
|
| getVolume | () | method |
public function getVolume():NumberGet the volume, from 0 to 1.
ReturnsNumber |
| pause | () | method |
public function pause():voidPause the media, if not already.
| play | () | method |
public function play():voidPlay the media, if not already.
| seek | () | method |
public function seek(position:Number):voidSeek to the specified position.
Parametersposition:Number |
| setVolume | () | method |
public function setVolume(volume:Number):voidSet the volume, between 0-1.
Parametersvolume:Number |
| unload | () | method |
public function unload():voidUnload the media.
| duration | event |
com.threerings.util.ValueEvent
Dispatched when the total duration of the media is known. value: a Number expressing the duration in seconds.
| error | event |
com.threerings.util.ValueEvent
Dispatched when there's a problem. value: a String error code/message.
| metadata | event |
com.threerings.util.ValueEvent
Dispatched when media metadata is available, if ever. value: metadata object.
See also
| position | event |
com.threerings.util.ValueEvent
Dispatched periodically as the position is updated, during playback. value: a Number expressing the position in seconds.
| state | event |
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