pause
pause(id: string, skipDispatchEvent?: boolean): void;
Pause a sound by its ID. The playback position is preserved — call resume to continue from the same point, or stop to discard it.
| Parameter | Type | Description |
|---|---|---|
id | string | ID of the sound to pause |
skipDispatchEvent | boolean | When true, suppresses the pause event |
Example
await soundHub.loadSounds([{ id: 'tokyo-train', url: 'tokyo-train-melody.mp3' }]);
soundHub.play('tokyo-train', { loop: true });
// Pause — position is saved
soundHub.pause('tokyo-train');
// Resume from the same position later
soundHub.resume('tokyo-train');
stopped
Tip: Pause preserves the playback position. Resume will continue from exactly where the sound left off.