How to Reset All Howler.js Instances
This article provides a quick guide on how to reset the state of all Howler.js audio instances simultaneously. You will learn how to stop all active playbacks, mute global audio, and completely unload all instances from memory using the global Howler API.
To reset or clear the state of all active audio instances in
Howler.js, you do not need to keep track of every individual
Howl object. Instead, you can use the global
Howler object (with a capital “H”), which controls the
global audio context and all active sound instances.
Stop All Audio Playback
If you want to immediately stop all currently playing audio across
all instances without destroying them, use the stop()
method on the global object:
Howler.stop();This stops all active sounds and resets their playback position back to the beginning.
Unload All Instances (Full Reset)
To perform a complete reset—which stops all playback, clears the
audio cache, and destroys all active Howl instances to free
up system memory—use the unload() method:
Howler.unload();After calling Howler.unload(), any previously created
Howl objects will no longer function, and you will need to
re-create them if you want to play those sounds again. This is the
recommended method when unloading a level in a game, navigating away
from a page, or performing a hard reset of your application’s audio
state.
Reset Global Volume and Mute States
If you also need to reset the global volume and mute settings to their default values alongside stopping the audio, you can apply these global commands:
// Stop all active playbacks
Howler.stop();
// Reset global volume to default (1.0)
Howler.volume(1.0);
// Ensure the global mute state is disabled
Howler.mute(false);