cc.audioEngine.play with volume 0

Hi, I’m using cc.audioEngine.play to play my audio effects, changing the volume with a slidebar.

This code works, but when the slider value is 0 it just plays the sound at full volume:

cc.audioEngine.play(this.startAudio, false, this.volumeBar.progress);

but it works if I use setVolume after it, like this:

var id = cc.audioEngine.play(this.startAudio, false, this.volumeBar.progress);
cc.audioEngine.setVolume(id, this.volumeBar.progress);

Is it a bug or is it intended to work this way? It would be nice to use play without having to set the volume manually every time.

1 Like