# HG changeset patch # User Nicholas Jillings # Date 1432981168 -3600 # Node ID 431f6bec460b900290f01e7824cc89220b06d4ce # Parent 7168f3616a00e7895a1a64af42ffa6390a395595 Bug #1256 Fix: Safari does not use 'this' on the buffer.onended to reference to the buffer, but to the Window. Now uses event. Tested on chrome OSX as well. diff -r 7168f3616a00 -r 431f6bec460b ape.js --- a/ape.js Sat May 30 10:51:55 2015 +0100 +++ b/ape.js Sat May 30 11:19:28 2015 +0100 @@ -374,7 +374,6 @@ if (this.status == 1) { this.audioObjects[id].outputGain.gain.value = 1.0; this.audioObjects[id].play(audioContext.currentTime+0.01); - this.audioObjects[id].flagAsPlayed(); } }; } diff -r 7168f3616a00 -r 431f6bec460b core.js --- a/core.js Sat May 30 10:51:55 2015 +0100 +++ b/core.js Sat May 30 11:19:28 2015 +0100 @@ -547,7 +547,7 @@ this.bufferNode.loop = audioEngineContext.loopPlayback; this.bufferNode.onended = function() { // Safari does not like using 'this' to reference the calling object! - this.owner.metric.stopListening(audioEngineContext.timer.getTestTime()); + event.srcElement.owner.metric.stopListening(audioEngineContext.timer.getTestTime()); }; if (this.bufferNode.loop == false) { this.metric.startListening(audioEngineContext.timer.getTestTime());