Mercurial > hg > webaudioevaluationtool
changeset 267:364f63f82a9c Dev_main
Fix Bug #1314
author | Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Jul 2015 14:04:08 +0100 |
parents | 23f4f4c0a13a |
children | af166dc1bfad |
files | core.js example_eval/project.xml |
diffstat | 2 files changed, 33 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/core.js Wed Jul 22 13:22:10 2015 +0100 +++ b/core.js Wed Jul 22 14:04:08 2015 +0100 @@ -1948,19 +1948,28 @@ // Update the playhead position, startPlay must be called if (this.timePerPixel > 0) { var time = this.playbackObject.getCurrentPosition(); - var width = 490; - var pix = Math.floor(time/this.timePerPixel); - this.scrubberHead.style.left = pix+'px'; - if (this.maxTime > 60.0) { - var secs = time%60; - var mins = Math.floor((time-secs)/60); - secs = secs.toString(); - secs = secs.substr(0,2); - mins = mins.toString(); - this.curTimeSpan.textContent = mins+':'+secs; + if (time > 0) { + var width = 490; + var pix = Math.floor(time/this.timePerPixel); + this.scrubberHead.style.left = pix+'px'; + if (this.maxTime > 60.0) { + var secs = time%60; + var mins = Math.floor((time-secs)/60); + secs = secs.toString(); + secs = secs.substr(0,2); + mins = mins.toString(); + this.curTimeSpan.textContent = mins+':'+secs; + } else { + time = time.toString(); + this.curTimeSpan.textContent = time.substr(0,4); + } } else { - time = time.toString(); - this.curTimeSpan.textContent = time.substr(0,4); + this.scrubberHead.style.left = '0px'; + if (this.maxTime < 60) { + this.curTimeSpan.textContent = '0.00'; + } else { + this.curTimeSpan.textContent = '00:00'; + } } } }; @@ -1969,12 +1978,21 @@ this.start = function() { if (this.playbackObject != undefined && this.interval == undefined) { - this.interval = setInterval(function(){interfaceContext.playhead.update();},100); + if (this.maxTime < 60) { + this.interval = setInterval(function(){interfaceContext.playhead.update();},10); + } else { + this.interval = setInterval(function(){interfaceContext.playhead.update();},100); + } } }; this.stop = function() { clearInterval(this.interval); this.interval = undefined; + if (this.maxTime < 60) { + this.curTimeSpan.textContent = '0.00'; + } else { + this.curTimeSpan.textContent = '00:00'; + } }; };
--- a/example_eval/project.xml Wed Jul 22 13:22:10 2015 +0100 +++ b/example_eval/project.xml Wed Jul 22 14:04:08 2015 +0100 @@ -43,7 +43,7 @@ <option name='playhead'/> </interface> </setup> - <audioHolder id='test-0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='true' elementComments='true'> + <audioHolder id='test-0' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='false' elementComments='true'> <interface> <title>Example Test Question</title> <scale position="0">Min</scale> @@ -86,7 +86,7 @@ <question id="genre" mandatory="true">Please enter the genre.</question> </PostTest> </audioHolder> - <audioHolder id='test-1' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='true' elementComments='true'> + <audioHolder id='test-1' hostURL="example_eval/" sampleRate="44100" randomiseOrder='true' repeatCount='0' loop='false' elementComments='true'> <interface> <title>Example Test Question</title> <scale position="0">Min</scale>