Settings for the audio player. This will override the initial values of the properties of the A5.audio.Player class.
Audio player class.
Rate of heartbeat in seconds, "0" equals no heartbeat, the default in "0.25".
Whether to loop playback.
Event for when playback is initiated, before playing has started. If still buffering "onPlay" will happen after "onLoaded". This event fires for both inital play, and resuming from paused.
Event fired when playback starts. This event fires for both inital play, and resuming from paused.
Event fired when playback is paused.
Event fired when audio player state changes.
The data for the change event
The type of change. "timeupdate" while playing, "durationchange" when the duration of the audio is availble or changes, "buffer" while the audio file is being buffered.
Event fired before audio is loaded.
An array of the sources of the audio file to load.
Event fired when audio is loaded. The "onChange" events "durationchange" type should be used to update display of the duration as the duration may not be avaiblibe on some devices when "onLoaded" fires.
Event fired when audio fails to load.
Event fired when playback is done, either by reaching the end, or by being stopped by the A5.audio.Player.stop() method.
The data for the done event
The type of done event. "end" for when the player hits the end on the audio while playing, "stop" for when the A5.audio.Player.stop() method is called.
The state of the audio player. State is updated by audio events, if you want to refresh "stale" state information use the A5.audio.Player.getState() method.
Whether the audio is loaded.
The source of the audio.
Whether the audio is a stream.
Whether the audio is playing.
Amount buffered, a value between 0.0 and 1.0.
Current play time of the audio in seconds.
Total duration of the audio in seconds.
Current volume, a value between 0.0 and 1.0.
Whether the audio is muted.
- getState Method
Refresh and return the state of the A5.audio.Player.
- load Method
Load an audio file to play.
- mute Method
Set whether the audio playback is muted.
- pause Method
Pause the audio.
- play Method
Play the audio. This will start audio playing from the current time. If the current time is at the end of the audio, audio will start playing from the beginning.
- seek Method
Seek to a given time in the audio.
- stop Method
Stop audio playback and set the current time back to "0".
- togglePlay Method
Toggle between playing and pausing the audio.
- volume Method
Set the volume of the audio playback.