The Audio library provides methods for loading and playing sounds using native system bridges.
Asynchronously loads an audio file and returns a handle ID.
- Example:
const (handle, err) = await Audio.loadAsync("music.mp3");
Synchronously loads an audio file and returns a handle ID.
- Example:
let music = Audio.load("sound.wav");
Plays the audio associated with the handle.
- Example:
Audio.play(music, { volume: 0.5 });
Pauses playback.
- Example:
Audio.pause(music);
Resumes paused playback.
- Example:
Audio.resume(music);
Stops playback immediately.
- Example:
Audio.stop(music);
Updates playback options like volume or pitch.
- Example:
Audio.setOptions(music, { pitch: 1.2 });