Option name | Type | Description |
---|---|---|
selector | domelement_or_querystring_or_jqueryobject | The element that contains a .js-player or .player element |
options | object | An object containing the settings for this audio player |
NATION.Utils
NATION.EventDispatcher
HTML5 audio player. Can be used with NATION.MediaControls for custom controls
Supports MP3, OGG, and WebM audio file formats, each of which are optional
To immediately start an audio file loading, include one of the following data attributes on the element represented by 'selector': data-mpeg, data-ogg, data-webm
Event that fires when the current track is ready to play
Event that fires when the audio starts playing
Event that fires when the audio is paused
Event that fires when the audio completes
Event that fires when some of the audio file is loaded
Event that fires regularly while audio file is playing
Event that fires when the audio file's meta data has been loaded
Check if the current audio file has ever been played
Useful for mobile devices where you might want an external play button (which wont work until the audio file has been played using native controls)
Returns the current play position (in seconds)
Returns the current progress percentage (0-1)
Returns percentage of current audio loaded
Returns duration of current track (in seconds)
Returns string with duration in 0:00:00 format
Returns string with current time in 0:00:00 format
Returns whether player can be used yet
Returns if video is currently playing
Plays the current track
Pauses the current track, if it's playing
Mutes the current track
Unmutes the current track
Option name | Type | Description |
---|---|---|
time | number | Time, in seconds, to seek to |
Seek audio to position
Option name | Type | Description |
---|---|---|
autoPlay | boolean | Start playing the new track immediately |
options | object | Object contianing the settings for the new track |
Play a new track (stops any currently playing)
Rebuild the player completely
This calls remove() and then creates a brand new HTML5 audio player using the last set audio URLs
Stops audio and removes player from the DOM