resumeAllSounds
Resume every paused sound. Each one carries on from the point where it was paused. It is the counterpart of pauseAllSounds.
resumeAllSounds(): void;
Parameters
This method takes no parameters.
Returns
Nothing.
Example
import { SoundHub } from 'soundhub';
const soundHub = new SoundHub();
await soundHub.loadSounds([
{ id: 'music', url: '/audio/theme.mp3' },
{ id: 'rain', url: '/audio/rain.mp3' },
]);
soundHub.play('music', { loop: true });
soundHub.play('rain', { loop: true });
soundHub.pauseAllSounds();
// Later: both continue from their own positions
soundHub.resumeAllSounds();
Try it
Control every sound at once
Idletokyo-trainstopped
bells-melodystopped
techno-tunestopped
One call reaches every sound. Each state comes from the events the library sends.
Code
Your clicks show up here as soundhub calls
Good to know
- Only paused sounds are resumed. Playing and stopped sounds are left alone.
- It resumes every paused sound, including ones you paused one by one with
pausebefore callingpauseAllSounds. - It calls
resumefor each sound, so every one dispatches its ownresumedevent. - Streams from
loadStreamare included.
See also
pauseAllSounds: pause everything at once.resume: resume a single sound.resumeContext: wake a suspended audio context.