From cbf070030e45e869ae759716a7bfafb404e733bd Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Tue, 12 May 2015 17:48:39 +0300 Subject: [PATCH] [FIX] One shot sounds playing again when switching tabs --- src/audio/audio_channel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/audio/audio_channel.js b/src/audio/audio_channel.js index 115ba3d3667..d361eb57752 100644 --- a/src/audio/audio_channel.js +++ b/src/audio/audio_channel.js @@ -176,6 +176,11 @@ pc.extend(pc, function () { // Connect up the nodes this.source.connect(this.gain); this.gain.connect(context.destination); + + if (!this.loop) { + // mark source as paused when it ends + this.source.onended = this.pause.bind(this); + } } };