Class: HTML5audioplayer

HTML5audioplayer

new HTML5audioplayer(settings)

HTML5 Audio player by NIMIUS Renders a audioplayer with circular progress and volume knobs.
Parameters:
Name Type Description
settings HT5AP_settings
Source:
Example
var player = new HTML5audioplayer({
     element: '#wrapper'
});
// note: this will replace the contents of #wrapper

player.addSong({ name: 'Testsong', mp3: '/path/song.mp3', ogg: '/path/song.ogg' })
player.play();

Members

player :HTMLElement

The HTML5 audio element that is used to play the audio
Type:
  • HTMLElement
Source:

playing :boolean

Whether or not the player is currently playing
Type:
  • boolean
Source:

Methods

addSong(song) → {number}

adds a song to the player. The song is added to the end of the playlist and the id of the newly added song is returned.
Parameters:
Name Type Description
song HT5AP_song
Source:
Returns:
- id of the new song for usage with HTML5audioplayer#setCurrentSong
Type
number

next()

Skips to the next song. If the current song is the last song in the playlist, the first song is played
Source:

pause()

Stops playback of the player
Source:

play()

Start playback of the player
Source:

prev()

Goes to the last song. If the current song is the first song in the playlist, the last song is played
Source:

setCurrentSong(id)

Sets the current song that the player is playing. The given parameter is the id in the songs array
Parameters:
Name Type Description
id number
Source:

setTime(time)

sets the current playback time of the player. Use this for skipping
Parameters:
Name Type Description
time number time in seconds
Source:

setVolume(vol)

sets the volume of the player.
Parameters:
Name Type Description
vol number between 0 and 1
Source:

toggleplay()

Toggles the playback state of the player. Starts playing, if it is currently not playing and pauses, if it is.
Source: