Skip to main content

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​

Try it

Control every sound at once

Idle
tokyo-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 pause before calling pauseAllSounds.
  • It calls resume for each sound, so every one dispatches its own resumed event.
  • Streams from loadStream are included.

See also​