# HG changeset patch # User Nicholas Jillings # Date 1432981168 -3600 # Node ID 1e2e437942913dafd8f5282fe57c851bee3f4203 # Parent fd648345dff912e559394ff74c9e590d68ba719a 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 fd648345dff9 -r 1e2e43794291 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 fd648345dff9 -r 1e2e43794291 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());