Class: Html5Audio

Html5Audio()

new Html5Audio()

The static class that handles HTML5 Audio.
Properties:
Name Type Description
url String [read-only] The url of the audio file.
volume Number The volume of the audio.

Methods

(static) addLoadListener(listner)

Add a callback function that will be called when the audio data is loaded.
Parameters:
Name Type Description
listner function The callback function

(static) clear()

Clears the audio data.

(static) fadeIn(duration)

Performs the audio fade-in.
Parameters:
Name Type Description
duration Number Fade-in time in seconds

(static) fadeOut(duration)

Performs the audio fade-out.
Parameters:
Name Type Description
duration Number Fade-out time in seconds

(static) initialize() → {Boolean}

Initializes the audio system.
Returns:
True if the audio system is available
Type
Boolean

(static) isError() → {Boolean}

Checks whether a loading error has occurred.
Returns:
True if a loading error has occurred
Type
Boolean

(static) isPlaying() → {Boolean}

Checks whether the audio is playing.
Returns:
True if the audio is playing
Type
Boolean

(static) isReady() → {Boolean}

Checks whether the audio data is ready to play.
Returns:
True if the audio data is ready to play
Type
Boolean

(static) play(loop, offset)

Plays the audio.
Parameters:
Name Type Description
loop Boolean Whether the audio data play in a loop
offset Number The start position to play in seconds

(static) seek()

Gets the seek position of the audio.

(static) setStaticSe(url)

Set the URL of static se.
Parameters:
Name Type Description
url String

(static) setup(url)

Sets up the Html5 Audio.
Parameters:
Name Type Description
url String The url of the audio file

(static) stop()

Stops the audio.