-
Notifications
You must be signed in to change notification settings - Fork 25
Audio: Events
Evandro Leopoldino Gonçalves edited this page May 21, 2025
·
2 revisions
To listen to an event, use the following method:
audio.on(eventType: string, callback: (param: { data: any }) => void)-
ready
Triggered after the audio file has been loaded and decoded.
datareturns aAudioBufferwith the following properties:-
duration: a float representing the sample rate, in samples per second, of the PCM data stored in the buffer. -
length: an integer representing the length, in sample-frames, of the PCM data stored in the buffer. -
numberOfChannels: a double representing the duration, in seconds, of the PCM data stored in the buffer. -
sampleRate: an integer representing the number of discrete audio channels described by the PCM data stored in the buffer.
-
-
start
Triggered as soon as the audio is played for the first time. -
end
Triggered as soon as the audio playback is complete. -
stateFires when the audio context's state changes.datareturns the possible values:-
suspended: the audio has been suspended. -
running: the audio is running. -
closed: the audio has been closed.
-