comparison interfaces/discrete.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 f0c74260c47d
comparison
equal deleted inserted replaced
1176:12ef00ae9dd5 1177:efe50b9d1d14
273 273
274 this.play.className = 'track-slider-button'; 274 this.play.className = 'track-slider-button';
275 this.play.textContent = "Loading..."; 275 this.play.textContent = "Loading...";
276 this.play.value = audioObject.id; 276 this.play.value = audioObject.id;
277 this.play.disabled = true; 277 this.play.disabled = true;
278 this.play.setAttribute("playstate","ready");
278 this.play.onclick = function(event) 279 this.play.onclick = function(event)
279 { 280 {
280 var id = Number(event.currentTarget.value); 281 var id = Number(event.currentTarget.value);
281 //audioEngineContext.metric.sliderPlayed(id); 282 //audioEngineContext.metric.sliderPlayed(id);
282 audioEngineContext.play(id); 283 if (event.currentTarget.getAttribute("playstate") == "ready")
284 audioEngineContext.play(id);
285 else if (event.currentTarget.getAttribute("playstate") == "playing")
286 audioEngineContext.stop();
283 }; 287 };
284 this.resize = function(event) 288 this.resize = function(event)
285 { 289 {
286 this.holder.style.width = window.innerWidth-200 + 'px'; 290 this.holder.style.width = window.innerWidth-200 + 'px';
287 this.discreteHolder.style.width = window.innerWidth-500 + 'px'; 291 this.discreteHolder.style.width = window.innerWidth-500 + 'px';
321 }; 325 };
322 326
323 this.startPlayback = function() 327 this.startPlayback = function()
324 { 328 {
325 // Called by audioObject when playback begins 329 // Called by audioObject when playback begins
330 this.play.setAttribute("playstate","playing");
326 $(".track-slider").removeClass('track-slider-playing'); 331 $(".track-slider").removeClass('track-slider-playing');
327 $(this.holder).addClass('track-slider-playing'); 332 $(this.holder).addClass('track-slider-playing');
328 var outsideReference = document.getElementById('outside-reference'); 333 var outsideReference = document.getElementById('outside-reference');
329 this.play.textContent = "Listening"; 334 this.play.textContent = "Listening";
330 if (outsideReference != null) { 335 if (outsideReference != null) {
332 } 337 }
333 } 338 }
334 this.stopPlayback = function() 339 this.stopPlayback = function()
335 { 340 {
336 // Called by audioObject when playback stops 341 // Called by audioObject when playback stops
342 this.play.setAttribute("playstate","ready");
337 $(this.holder).removeClass('track-slider-playing'); 343 $(this.holder).removeClass('track-slider-playing');
338 this.play.textContent = "Play"; 344 this.play.textContent = "Play";
339 } 345 }
340 346
341 this.getValue = function() 347 this.getValue = function()