I am working with
howler.js 2.0
but cant seem to get a simple example of updating the volume working. Here some a sample code:
window.sound = new Howl({
src:'http://example.com/assets/audio/background.mp3',
loop: true,
volume: 0.15
});
window.updateVolume = function(value) {
alert('before update volume:', window.sound.volume());
sound.volume = value;
alert('after update volume:', window.sound.volume());
}
I have tried both using volume() function
and just volume
property. None seem to work.
JsFiddle: https://jsfiddle.net/umx2bdm8/
What am I missing? Also, I noticed that if you click play
multiple times, multiple instances of the same sound start playing. I dont want that and hitting play
on a particular howl
instance should always work with that instance.
play
several times? – Extirpate