You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cool thanks, I got one more question. In my game I got multiple sounds played at almost the same time: fire and explosion (fast rocket launcher or machinegun). On ubuntu (using chrome) I got all the sounds queued so even if I stop firing, the sound of shot and of explode is still playing. On Firefox game crashes after Your last update (when stop() method is called, exaclty here: audio.currentTime = 0;) with:
InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable
EDIT: one more question - is there any way to figure out if sound is still playing?
via https://groups.google.com/forum/#!topic/gamejs/wFmkvKyiC6g
The Sound.stop() doesn't work as described in API.
function muteSound(sound) {
sound.stop();
}
bgMusic = new gamejs.audio.Sound(document.getElementById("bgMusic"));
muteSound(bgMusic);
So, it cause an error "audio.stop is not a function".
The solution is to use standard JavaScript methods.
bgMusic = document.getElementById("bgMusic");
muteSound(bgMusic);
function muteSound(sound) {
sound.pause();
}
The text was updated successfully, but these errors were encountered: