Player
Player
classThis class is responsible for managing the playing logic inside the application.
The user interface is managed by the Ui.Player
class.
Initializes all the necessary elements.
Returns null
Finds the record to play in the cache. Once the record
is found, delegates to the start
method.
Parameters
id
(Number | String) The element to play’s id.playlist
(Number | String) Optionally the current
playlist.keep_action
[Boolean] Whether to keep the
playing action or not.Returns null
Starts the player for a given record.
Parameters
record
Media The record to play.Returns null
Short-hand to pause the current playing media and reset the player interface.
Returns null
Facility to play the current media instance. It just
delegates to the instance’s play
method and change
the class of the pause button.
Returns null
Plays the next media.
Returns null
Plays the previous media unless the current media’s time is greater than 5 seconds; in this case, we just rewind it.
Returns null
Ditto play
but for pausing.
Returns null
Seeks the current media to the given percentage of time and update the position of the progress bar accordingly.
Parameters
seconds
Number The duration to go to.Returns null
Delegates to the instance’s setVolume
method and
updates the volume bar. Also stores the current
volume in the user’s configuration.
Parameters
volume
Number The volume between 0 and 1.skip_config
[Boolean] Whether to save the volume
in the configuration or not.Returns null
Mutes or unmutes the current volume.
Returns null
Toggles the repeat mode for the current playing media.
Returns null
Changes the playing mode for the current set.
Parameters
mode
String The playing mode for the current set.Returns null
Returns whether the player is paused or not.
Returns Boolean
Sorthand to access the current playing media based upon the record’s kind.
Returns HTMLMediaElement