isPlaying
isPlaying(id: string): boolean;
Check if a sound is currently playing. Returns true if the sound is actively playing, false otherwise.
Example
await soundManager.loadSounds([{ id: 'helicopter', url: 'helicopter.mp3' }]);
soundManager.play('helicopter', { loop: true });
// Check if the sound is currently playing
const playing = soundManager.isPlaying('helicopter');
console.log(playing); // true
soundManager.pause('helicopter');
console.log(soundManager.isPlaying('helicopter')); // false
Sound State
stopped
isPlaying: falseisPaused: falseisStopped: trueTry it: Use the buttons to change the helicopter sound's state. Watch the status update in real time —
isPlaying, isPaused, and isStopped are mutually exclusive.