Mercurial > hg > webaudioevaluationtool
comparison 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 |
comparison
equal
deleted
inserted
replaced
1176:12ef00ae9dd5 | 1177:efe50b9d1d14 |
---|---|
267 this.play.textContent = "Loading..."; | 267 this.play.textContent = "Loading..."; |
268 this.play.value = audioObject.id; | 268 this.play.value = audioObject.id; |
269 this.play.style.float = "left"; | 269 this.play.style.float = "left"; |
270 this.play.style.width = "100%"; | 270 this.play.style.width = "100%"; |
271 this.play.disabled = true; | 271 this.play.disabled = true; |
272 this.play.setAttribute("playstate","ready"); | |
272 this.play.onclick = function(event) | 273 this.play.onclick = function(event) |
273 { | 274 { |
274 var id = Number(event.currentTarget.value); | 275 var id = Number(event.currentTarget.value); |
275 //audioEngineContext.metric.sliderPlayed(id); | 276 //audioEngineContext.metric.sliderPlayed(id); |
276 audioEngineContext.play(id); | 277 audioEngineContext.play(id); |
277 $(".track-slider").removeClass('track-slider-playing'); | 278 if (event.currentTarget.getAttribute("playstate") == "ready") |
278 $(event.currentTarget.parentElement).addClass('track-slider-playing'); | 279 {audioEngineContext.play(id);} |
279 var outsideReference = document.getElementById('outside-reference'); | 280 else if (event.currentTarget.getAttribute("playstate") == "playing") |
280 if (outsideReference != null) { | 281 {audioEngineContext.stop();} |
281 $(outsideReference).removeClass('track-slider-playing'); | |
282 } | |
283 }; | 282 }; |
284 | 283 |
285 this.enable = function() { | 284 this.enable = function() { |
286 this.play.disabled = false; | 285 this.play.disabled = false; |
287 this.play.textContent = "Play"; | 286 this.play.textContent = "Play"; |
295 return node; | 294 return node; |
296 }; | 295 }; |
297 this.startPlayback = function() | 296 this.startPlayback = function() |
298 { | 297 { |
299 // Called when playback has begun | 298 // Called when playback has begun |
299 this.play.setAttribute("playstate","playing"); | |
300 $(".track-slider").removeClass('track-slider-playing'); | 300 $(".track-slider").removeClass('track-slider-playing'); |
301 $(this.holder).addClass('track-slider-playing'); | 301 $(this.holder).addClass('track-slider-playing'); |
302 var outsideReference = document.getElementById('outside-reference'); | 302 var outsideReference = document.getElementById('outside-reference'); |
303 if (outsideReference != null) { | 303 if (outsideReference != null) { |
304 $(outsideReference).removeClass('track-slider-playing'); | 304 $(outsideReference).removeClass('track-slider-playing'); |
305 } | 305 } |
306 }; | 306 }; |
307 this.stopPlayback = function() | 307 this.stopPlayback = function() |
308 { | 308 { |
309 // Called when playback has stopped. This gets called even if playback never started! | 309 // Called when playback has stopped. This gets called even if playback never started! |
310 this.play.setAttribute("playstate","ready"); | |
310 $(this.holder).removeClass('track-slider-playing'); | 311 $(this.holder).removeClass('track-slider-playing'); |
311 }; | 312 }; |
312 this.getValue = function() { | 313 this.getValue = function() { |
313 return this.slider.value; | 314 return this.slider.value; |
314 }; | 315 }; |