According the https://github.com/goldfire/howler.js#documentation you can pause, loop, or set the volume of a group of sounds, which is pretty useful in case of games. The question is, how do I define a group of sounds?
howler.js group of sounds. how?
You can't. The docs are simply falsely advertising the capabilities of the library about groups. –
Casual
By group they mean managing a single mp3 file containing all related sounds. For example managing a hero.mp3 file with tracks like jump, die, walk inside hero.mp3 Such files can be managed using group playback like this:
var sound = new Howl({
src: ['hero.webm', 'hero.mp3'],
sprite: {
jump: [0, 10000],
die: [11000, 15000],
walk: [16000,18000]
}
});
sound.play('jump');
// Change the volume of all tracks.
sound.volume(0.5);
// After a second, pause both sounds in the group.
setTimeout(function() {
sound.pause();
sound.play('walk');
}, 1000);
© 2022 - 2024 — McMap. All rights reserved.