Mercurial > hg > webaudioevaluationtool
diff interfaces/mushra.js @ 1177:efe50b9d1d14
Bug #1567: Updated rest of button based interfaces to follow AB playback controls.
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Thu, 11 Feb 2016 14:22:30 +0000 |
parents | c0022a09c4f6 |
children | 489910f8d539 |
line wrap: on
line diff
--- a/interfaces/mushra.js Thu Feb 11 14:16:09 2016 +0000 +++ b/interfaces/mushra.js Thu Feb 11 14:22:30 2016 +0000 @@ -269,17 +269,16 @@ this.play.style.float = "left"; this.play.style.width = "100%"; this.play.disabled = true; + this.play.setAttribute("playstate","ready"); this.play.onclick = function(event) { var id = Number(event.currentTarget.value); //audioEngineContext.metric.sliderPlayed(id); audioEngineContext.play(id); - $(".track-slider").removeClass('track-slider-playing'); - $(event.currentTarget.parentElement).addClass('track-slider-playing'); - var outsideReference = document.getElementById('outside-reference'); - if (outsideReference != null) { - $(outsideReference).removeClass('track-slider-playing'); - } + if (event.currentTarget.getAttribute("playstate") == "ready") + {audioEngineContext.play(id);} + else if (event.currentTarget.getAttribute("playstate") == "playing") + {audioEngineContext.stop();} }; this.enable = function() { @@ -297,6 +296,7 @@ this.startPlayback = function() { // Called when playback has begun + this.play.setAttribute("playstate","playing"); $(".track-slider").removeClass('track-slider-playing'); $(this.holder).addClass('track-slider-playing'); var outsideReference = document.getElementById('outside-reference'); @@ -307,6 +307,7 @@ this.stopPlayback = function() { // Called when playback has stopped. This gets called even if playback never started! + this.play.setAttribute("playstate","ready"); $(this.holder).removeClass('track-slider-playing'); }; this.getValue = function() {