# HG changeset patch # User Nicholas Jillings # Date 1455200550 0 # Node ID 8d01d2bf4b8fc5d270969db17cc3d24819dfb60e # Parent fbba14d4e21cb232f0d1460594b89c74d7d9f0e4 Bug #1567: Updated rest of button based interfaces to follow AB playback controls. diff -r fbba14d4e21c -r 8d01d2bf4b8f interfaces/discrete.js --- a/interfaces/discrete.js Thu Feb 11 14:16:09 2016 +0000 +++ b/interfaces/discrete.js Thu Feb 11 14:22:30 2016 +0000 @@ -275,11 +275,15 @@ this.play.textContent = "Loading..."; this.play.value = audioObject.id; 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); + if (event.currentTarget.getAttribute("playstate") == "ready") + audioEngineContext.play(id); + else if (event.currentTarget.getAttribute("playstate") == "playing") + audioEngineContext.stop(); }; this.resize = function(event) { @@ -323,6 +327,7 @@ this.startPlayback = function() { // Called by audioObject when playback begins + this.play.setAttribute("playstate","playing"); $(".track-slider").removeClass('track-slider-playing'); $(this.holder).addClass('track-slider-playing'); var outsideReference = document.getElementById('outside-reference'); @@ -334,6 +339,7 @@ this.stopPlayback = function() { // Called by audioObject when playback stops + this.play.setAttribute("playstate","ready"); $(this.holder).removeClass('track-slider-playing'); this.play.textContent = "Play"; } diff -r fbba14d4e21c -r 8d01d2bf4b8f interfaces/horizontal-sliders.js --- a/interfaces/horizontal-sliders.js Thu Feb 11 14:16:09 2016 +0000 +++ b/interfaces/horizontal-sliders.js Thu Feb 11 14:22:30 2016 +0000 @@ -263,11 +263,15 @@ this.play.textContent = "Loading..."; this.play.value = audioObject.id; 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); + if (event.currentTarget.getAttribute("playstate") == "ready") + {audioEngineContext.play(id);} + else if (event.currentTarget.getAttribute("playstate") == "playing") + {audioEngineContext.stop();} }; this.resize = function(event) { @@ -288,6 +292,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'); @@ -298,6 +303,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() diff -r fbba14d4e21c -r 8d01d2bf4b8f interfaces/mushra.js --- 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() {