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
- Adds a callback function that will be called when the audio data is loaded
Name Type Description listnerfunction The callback function - Adds a callback function that will be called when the playback is stopped
Name Type Description listnerfunction The callback function - Clears the audio data
- Destroys the audio
- Performs the audio fade-in
Name Type Description durationnumber Fade-in time in seconds - Performs the audio fade-out
Name Type Description durationnumber 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 loopboolean Whether the audio data play in a loop offsetnumber The start position to play in seconds - Tries to load the audio again
- Gets the seek position of the audio
- Stops the audio
- 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 valuenumber The master volume (0 to 1)