Sound.stop() method doesn't work

27 views
Skip to first unread message

splash27

unread,
Jan 24, 2015, 6:51:48 AM1/24/15
to gam...@googlegroups.com
Hello!

I found a bug! Just a notice. The problem can be solved another way.

The Sound.stop() doesn't work as described in API.
<audio id="bgMusic" src="/sounds/mus.mp3" autoplay loop></audio>


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();
}


Simon Oberhammer

unread,
Jan 25, 2015, 3:41:39 AM1/25/15
to gam...@googlegroups.com
good catch.

gamejs should provide both: pause() and stop() where stop would also "rewind" the audio.

AmBeam

unread,
Jul 22, 2015, 1:18:12 PM7/22/15
to GameJs
So is it fixed now?

si...@nekapuzer.at

unread,
Jul 22, 2015, 1:52:30 PM7/22/15
to gam...@googlegroups.com
i pushed the fix to master. haven't tested it much, if you have feedback: https://github.com/GameJs/gamejs/issues/95

 simon

July 22 2015 7:18 PM, "AmBeam" <tobias...@huuugegames.com> wrote:
So is it fixed now?
--
You received this message because you are subscribed to the Google Groups "GameJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gamejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages