====== MediaPlaylist ======
This object allows you to play media files.
===== Functions =====
==== MediaPlaylist ====
Constructor function.
=== Syntax ===
var myObject = new MediaPlaylist();
===== Methods =====
==== setPlaybackRate ====
Sets the playback rate.
=== Syntax ===
myObject.setPlaybackRate(rate);
=== Arguments ===
- rate - (float) the playback rate
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== setVolume ====
Sets the volume.
=== Syntax ===
myObject.setVolume(volume);
=== Arguments ===
- volume - (float) the volume
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== setPosition ====
Sets the position of the current playing item.
=== Syntax ===
myObject.setPosition(position);
=== Arguments ===
- position - (integer) the position in milliseconds
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== setMuted ====
Mutes or unmutes the current playing media.
=== Syntax ===
myObject.setMuted(muted);
=== Arguments ===
- muted - (boolean) the media's muted status
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== 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 the playlist.
=== Syntax ===
myObject.play();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== pause ====
Pauses the playing.
=== Syntax ===
myObject.pause();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== stop ====
Stops the playing.
=== Syntax ===
myObject.stop();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== addLocalMedia ====
Adds a local media to the playlist.
=== Syntax ===
myObject.addLocalMedia(path);
=== Arguments ===
- path - (string) the local media to add
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (AddMediaError) add media failed
==== addDistantMedia ====
Adds a distant media to the playlist.
=== Syntax ===
myObject.addDistantMedia(url);
=== Arguments ===
- url - (string) the distant media to add
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (AddMediaError) add media failed
==== insertLocalMedia ====
Inserts a local media to the playlist.
=== Syntax ===
myObject.insertLocalMedia(position, path);
=== Arguments ===
- position - (integer) the position where to insert the media
- path - (string) the local media to insert
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (InsertMediaError) insert media failed
==== insertDistantMedia ====
Inserts a distant media to the playlist.
=== Syntax ===
myObject.insertDistantMedia(position, path);
=== Arguments ===
- position - (integer) the position where to insert the media
- path - (string) the distant media to insert
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (InsertMediaError) insert media failed
==== clear ====
Clears the playlist contents.
=== Syntax ===
myObject.clear();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (ClearMediaError) clearing playlist failed
==== next ====
Plays the next playlist item.
=== Syntax ===
myObject.next();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== previous ====
Plays the previous playlist item.
=== Syntax ===
myObject.previous();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== setCurrentMedia ====
Sets the current media to play.
=== Syntax ===
myObject.setCurrentMedia(mediaIndex);
=== Arguments ===
- mediaIndex - (integer) the media index
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== shuffle ====
Shuffles randomly the playlist.
=== Syntax ===
myObject.shuffle();
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== setPlaybackMode ====
Sets the playback mode.
=== Syntax ===
myObject.setPlaybackMode(playbackMode);
=== Arguments ===
- playbackMode - ([[#playbackmode|PlaybackMode]]) the playback mode
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
==== removeMedia ====
Removes a media from the list.
=== Syntax ===
myObject.removeMedia(mediaIndex);
=== Arguments ===
- mediaIndex - (integer) the media index
=== Returns ===
* (MediaPlaylist) this MediaPlaylist
=== Exceptions ===
* (RemoveMediaError) remove media failed
==== currentMedia ====
Returns the current playing media index.
=== Syntax ===
myObject.currentMedia();
=== Returns ===
* (integer) the current playing media index
==== isEmpty ====
Returns true if the playlist is empty.
=== Syntax ===
myObject.isEmpty();
=== Returns ===
* (boolean) true if the playlist is empty
==== mediaCount ====
Returns the playlist size.
=== Syntax ===
myObject.mediaCount();
=== Returns ===
* (integer) the playlist size
==== nextMedia ====
Returns the next media index.
=== Syntax ===
myObject.nextMedia();
=== Returns ===
* (integer) the next media index
==== previousMedia ====
Returns the previous media index.
=== Syntax ===
myObject.previousMedia();
=== Returns ===
* (integer) the previous media index
==== playbackMode ====
Returns the playback mode.
=== Syntax ===
myObject.playbackMode();
=== Returns ===
* ([[#playbackmode|PlaybackMode]]) the playback mode
===== Attributes =====
==== playbackRate ====
The playback rate. (float)
==== volume ====
The volume. (float)
==== position ====
The position in milliseconds. (integer)
==== muted ====
If the media is muted. (boolean)
==== currentMedia ====
The current media index. (integer)
==== playbackMode ====
The playback mode. ([[#playbackmode|PlaybackMode]])
===== Enumerations =====
==== PlaybackMode ====
The playback mode.
=== Values ===
- CurrentItemOnce: the current item is played only one
- CurrentItemInLoop: the current item is played in the loop
- Sequential: playback starts from the first to the last items and stops
- Loop: playback restarts at the first item after the last has finished playing
- Random: plays items in random order