Mercurial > hg > webaudioevaluationtool
changeset 896:ce1f952a36f3
Fixed listen tracker for non-looping audioElements reporting start and stop were time 0
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 11 Jun 2015 09:45:52 +0100 |
parents | e2e39f867db3 |
children | b7f262db9886 |
files | core.js |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Thu Jun 11 09:38:09 2015 +0100 +++ b/core.js Thu Jun 11 09:45:52 2015 +0100 @@ -818,7 +818,7 @@ this.bufferNode.loop = audioEngineContext.loopPlayback; this.bufferNode.onended = function() { // Safari does not like using 'this' to reference the calling object! - event.srcElement.owner.metric.stopListening(audioEngineContext.timer.getTestTime()); + event.srcElement.owner.metric.stopListening(audioEngineContext.timer.getTestTime(),event.srcElement.owner.getCurrentPosition()); }; if (this.bufferNode.loop == false) { this.metric.startListening(audioEngineContext.timer.getTestTime()); @@ -830,9 +830,9 @@ this.stop = function() { if (this.bufferNode != undefined) { + this.metric.stopListening(audioEngineContext.timer.getTestTime(),this.getCurrentPosition()); this.bufferNode.stop(0); this.bufferNode = undefined; - this.metric.stopListening(audioEngineContext.timer.getTestTime()); } }; @@ -1001,7 +1001,7 @@ } }; - this.stopListening = function(time) + this.stopListening = function(time,bufferStopTime) { if (this.listenHold == true) { @@ -1014,7 +1014,11 @@ var testTime = evnt.getElementsByTagName('testTime')[0]; var bufferTime = evnt.getElementsByTagName('bufferTime')[0]; testTime.setAttribute('stop',time); - bufferTime.setAttribute('stop',this.parent.getCurrentPosition()); + if (bufferStopTime == undefined) { + bufferTime.setAttribute('stop',this.parent.getCurrentPosition()); + } else { + bufferTime.setAttribute('stop',bufferStopTime); + } console.log('slider ' + this.parent.id + ' played for (' + diff + ')'); // DEBUG/SAFETY: show played slider id } };