User Tools

Site Tools


en:code:system:mediaplayer

This is an old revision of the document!


MediaPlayer

This object allows you to play media files.

Functions

MediaPlayer

Constructor function.

Syntax

var myObject = new MediaPlayer();

Methods

setPlaybackRate

Sets the playback rate.

Syntax

myObject.setPlaybackRate(rate);

Arguments

  1. rate - (float) the playback rate

Returns

  • (MediaPlayer) this MediaPlayer

setVolume

Sets the volume.

Syntax

myObject.setVolume(volume);

Arguments

  1. volume - (float) the volume

Returns

  • (MediaPlayer) this MediaPlayer

setPosition

Sets the position of the current playing item.

Syntax

myObject.setPosition(position);

Arguments

  1. position - (integer) the position in milliseconds

Returns

  • (MediaPlayer) this MediaPlayer

setMuted

Mutes or unmutes the current playing media.

Syntax

myObject.setMuted(muted);

Arguments

  1. muted - (boolean) the media's muted status

Returns

  • (MediaPlayer) this MediaPlayer

duration

Returns the duration of the current media.

Syntax

myObject.duration();

Returns

  • (integer) the duration of the current media

hasAudio

Returns true if the current media has audio.

Syntax

myObject.hasAudio();

Returns

  • (boolean) true if the current media has audio

hasVideo

Returns true if the current media has video.

Syntax

myObject.hasVideo();

Returns

  • (boolean) true if the current media has video

playbackRate

Returns the current playback rate.

Syntax

myObject.playbackRate();

Returns

  • (boolean) the current playback rate

volume

Returns the current volume.

Syntax

myObject.volume();

Returns

  • (boolean) the current volume

position

Returns the current position.

Syntax

myObject.position();

Returns

  • (boolean) the current position in milliseconds

isMuted

Returns true if the current media is muted.

Syntax

myObject.isMuted();

Returns

  • (boolean) true if the current media is muted

isSeekable

Returns true if the current media is seekable. Seekable means that you can seek to a specific position to play.

Syntax

myObject.isSeekable();

Returns

  • (boolean) true if the current media is seekable

bufferStatus

Returns the percentage of filled buffer.

Syntax

myObject.bufferStatus();

Returns

  • (boolean) the percentage of filled buffer

play

Begins playing.

Syntax

myObject.play();

Returns

  • (MediaPlayer) this MediaPlayer

pause

Pauses the playing.

Syntax

myObject.pause();

Returns

  • (MediaPlayer) this MediaPlayer

stop

Stops the playing.

Syntax

myObject.stop();

Returns

  • (MediaPlayer) this MediaPlayer

setLocalMedia

Plays a local media.

Syntax

myObject.setLocalMedia(path);

Arguments

  1. path - (string) the local media to play

Returns

  • (MediaPlayer) this MediaPlayer

Exceptions

  • (AddMediaError) add media failed

addDistantMedia

Plays a distant media.

Syntax

myObject.setDistantMedia(url);

Arguments

  1. url - (string) the distant media to play

Returns

  • (MediaPlayer) this MediaPlayer

Exceptions

  • (AddMediaError) add media failed

Attributes

playbackRate

The playback rate. (float)

volume

The volume. (float)

position

The position in milliseconds. (integer)

muted

If the media is muted. (boolean)

en/code/system/mediaplayer.1761246844.txt.gz · Last modified: by jmgr