Some of the static methods listed here DO NOT APPLY to the AmstramgramAudioPlayer class.
They are marked with a .
The and marks indicate that the properties have respectively a getter and a setter.
Some of the static methods listed here DO NOT APPLY to the AmstramgramAudioPlayer class.
They are marked with a .
The and marks indicate that the properties have respectively a getter and a setter.
/**
* @set audioOptions
* @params {object}
* @description : set the audio players default options .
*/
//Set the default aria-label content for audio players HTML wrappers.
AmstramgramMediaPlayer.audioOptions = {appLabel: 'Lecteur Audio'}
/**
* @get audioOptions
* @returns {object}
* @description : get the audio players default options .
*/
console.log(AmstramgramMediaPlayer.audioOptions.appLabel)
//Should output : Lecteur Audio
/**
* @get currentPlayer
* @returns {AmstramgramAudioPlayer | AmstramgramVideoPlayer | undefined}
* @description : Returns the current player or undefined if there is none.
*/
//Pauses the current player if it's playing
if (AmstramgramMediaPlayer.currentPlayer && !AmstramgramMediaPlayer.currentPlayer.paused) {
AmstramgramMediaPlayer.currentPlayer.pause()
}
//Same thing if you use AmstramgramAudioPlayer class
if (AmstramgramAudioPlayer.currentPlayer && !AmstramgramAudioPlayer.currentPlayer.paused) {
AmstramgramAudioPlayer.currentPlayer.pause()
}
/**
* @set options
* @params {object}
* @description : set the players default options .
*/
//Set the default aria-label content for all players HTML wrappers.
AmstramgramMediaPlayer.options = {appLabel: 'Multimedia Player'}
//Or if you're using the AmstramgramAudioPlayer class :
AmstramgramAudioPlayer.options = {appLabel: 'My beautiful Audio Player'}
/**
* @get options
* @returns {object}
* @description : get the players default options .
*/
console.log(AmstramgramMediaPlayer.options.appLabel)
//Should output : Multimedia Player
/**
* @get players
* @returns {array}
* @description : returns an array of all instantiated players.
*/
//Hides the download button of all players.
AmstramgramMediaPlayer.players.forEach( player => player.download = {hidden: true} )
/**
* @set videoOptions
* @params {object}
* @description : set the video players default options .
*/
//Set the default aria-label content for video players HTML wrappers.
AmstramgramMediaPlayer.videoOptions = {appLabel: 'Lecteur Vidéo'}
/**
* @get videoOptions
* @returns {object}
* @description : returns the video players default options .
*/
console.log(AmstramgramMediaPlayer.videoOptions.appLabel)
//Should output : Lecteur Vidéo