en:code:system:mediaplaylist
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | en:code:system:mediaplaylist [2021/02/13 11:23] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== MediaPlaylist ====== | ||
+ | This object allows you to play media files. | ||
+ | ===== Functions ===== | ||
+ | |||
+ | ==== MediaPlaylist ==== | ||
+ | Constructor function. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | var myObject = new MediaPlaylist(); | ||
+ | </ | ||
+ | |||
+ | ===== Methods ===== | ||
+ | |||
+ | ==== setPlaybackRate ==== | ||
+ | Sets the playback rate. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.setPlaybackRate(rate); | ||
+ | </ | ||
+ | |||
+ | === Arguments === | ||
+ | - rate - (float) the playback rate | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== setVolume ==== | ||
+ | Sets the volume. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.setVolume(volume); | ||
+ | </ | ||
+ | |||
+ | === Arguments === | ||
+ | - volume - (float) the volume | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== setPosition ==== | ||
+ | Sets the position of the current playing item. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.setPosition(position); | ||
+ | </ | ||
+ | |||
+ | === 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); | ||
+ | </ | ||
+ | |||
+ | === Arguments === | ||
+ | - muted - (boolean) the media' | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== duration ==== | ||
+ | Returns the duration of the current media. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.duration(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (integer) the duration of the current media | ||
+ | |||
+ | ==== hasAudio ==== | ||
+ | Returns true if the current media has audio. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.hasAudio(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) true if the current media has audio | ||
+ | |||
+ | ==== hasVideo ==== | ||
+ | Returns true if the current media has video. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.hasVideo(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) true if the current media has video | ||
+ | |||
+ | ==== playbackRate ==== | ||
+ | Returns the current playback rate. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.playbackRate(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) the current playback rate | ||
+ | |||
+ | ==== volume ==== | ||
+ | Returns the current volume. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.volume(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) the current volume | ||
+ | |||
+ | ==== position ==== | ||
+ | Returns the current position. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.position(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) the current position in milliseconds | ||
+ | |||
+ | ==== isMuted ==== | ||
+ | Returns true if the current media is muted. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | 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 === | ||
+ | <code javascript> | ||
+ | myObject.isSeekable(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) true if the current media is seekable | ||
+ | |||
+ | ==== bufferStatus ==== | ||
+ | Returns the percentage of filled buffer. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.bufferStatus(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) the percentage of filled buffer | ||
+ | |||
+ | ==== play ==== | ||
+ | Begins playing the playlist. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.play(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== pause ==== | ||
+ | Pauses the playing. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.pause(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== stop ==== | ||
+ | Stops the playing. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.stop(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== addLocalMedia ==== | ||
+ | Adds a local media to the playlist. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | 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 === | ||
+ | <code javascript> | ||
+ | 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 === | ||
+ | <code javascript> | ||
+ | myObject.insertLocalMedia(position, | ||
+ | </ | ||
+ | |||
+ | === 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, | ||
+ | </ | ||
+ | |||
+ | === 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(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | === Exceptions === | ||
+ | * (ClearMediaError) clearing playlist failed | ||
+ | |||
+ | ==== next ==== | ||
+ | Plays the next playlist item. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.next(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== previous ==== | ||
+ | Plays the previous playlist item. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.previous(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== setCurrentMedia ==== | ||
+ | Sets the current media to play. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.setCurrentMedia(mediaIndex); | ||
+ | </ | ||
+ | |||
+ | === Arguments === | ||
+ | - mediaIndex - (integer) the media index | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== shuffle ==== | ||
+ | Shuffles randomly the playlist. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.shuffle(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== setPlaybackMode ==== | ||
+ | Sets the playback mode. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.setPlaybackMode(playbackMode); | ||
+ | </ | ||
+ | |||
+ | === Arguments === | ||
+ | - playbackMode - ([[# | ||
+ | |||
+ | === Returns === | ||
+ | * (MediaPlaylist) this MediaPlaylist | ||
+ | |||
+ | ==== removeMedia ==== | ||
+ | Removes a media from the list. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | 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 === | ||
+ | <code javascript> | ||
+ | myObject.currentMedia(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (integer) the current playing media index | ||
+ | |||
+ | ==== isEmpty ==== | ||
+ | Returns true if the playlist is empty. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.isEmpty(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (boolean) true if the playlist is empty | ||
+ | |||
+ | ==== mediaCount ==== | ||
+ | Returns the playlist size. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.mediaCount(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (integer) the playlist size | ||
+ | |||
+ | ==== nextMedia ==== | ||
+ | Returns the next media index. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.nextMedia(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (integer) the next media index | ||
+ | |||
+ | ==== previousMedia ==== | ||
+ | Returns the previous media index. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.previousMedia(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * (integer) the previous media index | ||
+ | |||
+ | ==== playbackMode ==== | ||
+ | Returns the playback mode. | ||
+ | |||
+ | === Syntax === | ||
+ | <code javascript> | ||
+ | myObject.playbackMode(); | ||
+ | </ | ||
+ | |||
+ | === Returns === | ||
+ | * ([[# | ||
+ | |||
+ | ===== 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. ([[# | ||
+ | |||
+ | ===== Enumerations ===== | ||
+ | |||
+ | ==== PlaybackMode ==== | ||
+ | The playback mode. | ||
+ | |||
+ | === Values === | ||
+ | - CurrentItemOnce: | ||
+ | - CurrentItemInLoop: | ||
+ | - 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: 2021/02/13 11:23 by 127.0.0.1