User Tools

Site Tools


en:code:system:mediaplaylist

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:code:system:mediaplaylist [2020/02/09 13:26] (current)
Line 1: Line 1:
 +====== MediaPlaylist ======
 +This object allows you to play media files.
  
 +===== Functions =====
 +
 +==== MediaPlaylist ====
 +Constructor function.
 +
 +=== Syntax ===
 +<code javascript>​
 +var myObject = new MediaPlaylist();​
 +</​code>​
 +
 +===== Methods =====
 +
 +==== setPlaybackRate ====
 +Sets the playback rate.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setPlaybackRate(rate);​
 +</​code>​
 +
 +=== Arguments ===
 +  - rate - (float) the playback rate
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== setVolume ====
 +Sets the volume.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setVolume(volume);​
 +</​code>​
 +
 +=== Arguments ===
 +  - volume - (float) the volume
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== setPosition ====
 +Sets the position of the current playing item.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setPosition(position);​
 +</​code>​
 +
 +=== Arguments ===
 +  - position - (integer) the position in milliseconds
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== setMuted ====
 +Mutes or unmutes the current playing media.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setMuted(muted);​
 +</​code>​
 +
 +=== Arguments ===
 +  - muted - (boolean) the media'​s muted status
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== duration ====
 +Returns the duration of the current media.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.duration();​
 +</​code>​
 +
 +=== Returns ===
 +  * (integer) the duration of the current media
 +
 +==== hasAudio ====
 +Returns true if the current media has audio.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.hasAudio();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) true if the current media has audio
 +
 +==== hasVideo ====
 +Returns true if the current media has video.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.hasVideo();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) true if the current media has video
 +
 +==== playbackRate ====
 +Returns the current playback rate.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.playbackRate();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) the current playback rate
 +
 +==== volume ====
 +Returns the current volume.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.volume();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) the current volume
 +
 +==== position ====
 +Returns the current position.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.position();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) the current position in milliseconds
 +
 +==== isMuted ====
 +Returns true if the current media is muted.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.isMuted();​
 +</​code>​
 +
 +=== 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 ===
 +<code javascript>​
 +myObject.isSeekable();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) true if the current media is seekable
 +
 +==== bufferStatus ====
 +Returns the percentage of filled buffer.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.bufferStatus();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) the percentage of filled buffer
 +
 +==== play ====
 +Begins playing the playlist.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.play();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== pause ====
 +Pauses the playing.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.pause();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== stop ====
 +Stops the playing.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.stop();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== addLocalMedia ====
 +Adds a local media to the playlist.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.addLocalMedia(path);​
 +</​code>​
 +
 +=== 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 ===
 +<code javascript>​
 +myObject.addDistantMedia(url);​
 +</​code>​
 +
 +=== 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 ===
 +<code javascript>​
 +myObject.insertLocalMedia(position,​ path);
 +</​code>​
 +
 +=== 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 ===
 +<code javascript>​
 +myObject.insertDistantMedia(position,​ path);
 +</​code>​
 +
 +=== 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 ===
 +<code javascript>​
 +myObject.clear();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +=== Exceptions ===
 +  * (ClearMediaError) clearing playlist failed
 +
 +==== next ====
 +Plays the next playlist item.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.next();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== previous ====
 +Plays the previous playlist item.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.previous();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== setCurrentMedia ====
 +Sets the current media to play.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setCurrentMedia(mediaIndex);​
 +</​code>​
 +
 +=== Arguments ===
 +  - mediaIndex - (integer) the media index
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== shuffle ====
 +Shuffles randomly the playlist.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.shuffle();​
 +</​code>​
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== setPlaybackMode ====
 +Sets the playback mode.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.setPlaybackMode(playbackMode);​
 +</​code>​
 +
 +=== Arguments ===
 +  - playbackMode - ([[#​playbackmode|PlaybackMode]]) the playback mode
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +==== removeMedia ====
 +Removes a media from the list.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.removeMedia(mediaIndex);​
 +</​code>​
 +
 +=== Arguments ===
 +  - mediaIndex - (integer) the media index
 +
 +=== Returns ===
 +  * (MediaPlaylist) this MediaPlaylist
 +
 +=== Exceptions ===
 +  * (RemoveMediaError) remove media failed
 +
 +==== currentMedia ====
 +Returns the current playing media index.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.currentMedia();​
 +</​code>​
 +
 +=== Returns ===
 +  * (integer) the current playing media index
 +
 +==== isEmpty ====
 +Returns true if the playlist is empty.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.isEmpty();​
 +</​code>​
 +
 +=== Returns ===
 +  * (boolean) true if the playlist is empty
 +
 +==== mediaCount ====
 +Returns the playlist size.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.mediaCount();​
 +</​code>​
 +
 +=== Returns ===
 +  * (integer) the playlist size
 +
 +==== nextMedia ====
 +Returns the next media index.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.nextMedia();​
 +</​code>​
 +
 +=== Returns ===
 +  * (integer) the next media index
 +
 +==== previousMedia ====
 +Returns the previous media index.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.previousMedia();​
 +</​code>​
 +
 +=== Returns ===
 +  * (integer) the previous media index
 +
 +==== playbackMode ====
 +Returns the playback mode.
 +
 +=== Syntax ===
 +<code javascript>​
 +myObject.playbackMode();​
 +</​code>​
 +
 +=== 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
en/code/system/mediaplaylist.txt ยท Last modified: 2020/02/09 13:26 (external edit)