The audio object of Web Audio API.
Name | Type | Description |
---|---|---|
url |
string |
The url of the audio file. |
Members
-
The pan of the audio.
-
The pitch of the audio.
-
The url of the audio file.
-
The volume of the audio.
Methods
-
Initializes the audio system.
Returns:
Type Description boolean True if the audio system is available. -
Sets the master volume for all audio.
Name Type Description value
number The master volume (0 to 1).
-
Adds a callback function that will be called when the audio data is loaded.
Name Type Description listner
function The callback function.
-
Adds a callback function that will be called when the playback is stopped.
Name Type Description listner
function The callback function.
-
Clears the audio data.
-
Destroys the audio.
-
Performs the audio fade-in.
Name Type Description duration
number Fade-in time in seconds.
-
Performs the audio fade-out.
Name Type Description duration
number Fade-out time in seconds.
-
Checks whether a loading error has occurred.
Returns:
Type Description boolean True if a loading error has occurred. -
Checks whether the audio is playing.
Returns:
Type Description boolean True if the audio is playing. -
Checks whether the audio data is ready to play.
Returns:
Type Description boolean True if the audio data is ready to play. -
Plays the audio.
Name Type Description loop
boolean Whether the audio data play in a loop.
offset
number The start position to play in seconds.
-
Tries to load the audio again.
-
Gets the seek position of the audio.
-
Stops the audio.