en | fr

The Player class


This class is responsible for managing the playing logic inside the application.

The user interface is managed by the Ui.Player class.


initialize

Initializes all the necessary elements.

Returns null


preload

Finds the record to play in the cache. Once the record is found, delegates to the start method.

Parameters

Returns null


start

Starts the player for a given record.

Parameters

Returns null


stop

Short-hand to pause the current playing media and reset the player interface.

Returns null


play

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


playNext

Plays the next media.

Returns null


playPrevious

Plays the previous media unless the current media’s time is greater than 5 seconds; in this case, we just rewind it.

Returns null


pause

Ditto play but for pausing.

Returns null


goTo

Seeks the current media to the given percentage of time and update the position of the progress bar accordingly.

Parameters

Returns null


setVolume

Delegates to the instance’s setVolume method and updates the volume bar. Also stores the current volume in the user’s configuration.

Parameters

Returns null


toggleMute

Mutes or unmutes the current volume.

Returns null


toggleRepeat

Toggles the repeat mode for the current playing media.

Returns null


currentSetMode

Changes the playing mode for the current set.

Parameters

Returns null


paused

Returns whether the player is paused or not.

Returns Boolean


media

Sorthand to access the current playing media based upon the record’s kind.

Returns HTMLMediaElement