isStopped
isStopped(id: string): boolean;
Check if a sound is currently stopped. Returns true if the sound has been stopped via stop or has never been started, false otherwise.
Example
await soundHub.loadSounds([{ id: 'helicopter', url: 'helicopter.mp3' }]);
console.log(soundHub.isStopped('helicopter')); // true (not yet started)
soundHub.play('helicopter', { loop: true });
console.log(soundHub.isStopped('helicopter')); // false
soundHub.stop('helicopter');
console.log(soundHub.isStopped('helicopter')); // true
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.