Mercurial > hg > webaudioevaluationtool
comparison interfaces/horizontal-sliders.js @ 508:8d01d2bf4b8f Dev_main
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 | cb348f6208b2 |
children | df2d916fd9cf |
comparison
equal
deleted
inserted
replaced
507:fbba14d4e21c | 508:8d01d2bf4b8f |
---|---|
261 | 261 |
262 this.play.className = 'track-slider-button'; | 262 this.play.className = 'track-slider-button'; |
263 this.play.textContent = "Loading..."; | 263 this.play.textContent = "Loading..."; |
264 this.play.value = audioObject.id; | 264 this.play.value = audioObject.id; |
265 this.play.disabled = true; | 265 this.play.disabled = true; |
266 this.play.setAttribute("playstate","ready"); | |
266 this.play.onclick = function(event) | 267 this.play.onclick = function(event) |
267 { | 268 { |
268 var id = Number(event.currentTarget.value); | 269 var id = Number(event.currentTarget.value); |
269 //audioEngineContext.metric.sliderPlayed(id); | 270 //audioEngineContext.metric.sliderPlayed(id); |
270 audioEngineContext.play(id); | 271 if (event.currentTarget.getAttribute("playstate") == "ready") |
272 {audioEngineContext.play(id);} | |
273 else if (event.currentTarget.getAttribute("playstate") == "playing") | |
274 {audioEngineContext.stop();} | |
271 }; | 275 }; |
272 this.resize = function(event) | 276 this.resize = function(event) |
273 { | 277 { |
274 this.holder.style.width = window.innerWidth-200 + 'px'; | 278 this.holder.style.width = window.innerWidth-200 + 'px'; |
275 this.slider.style.width = window.innerWidth-420 + 'px'; | 279 this.slider.style.width = window.innerWidth-420 + 'px'; |
286 // progress is a value from 0 to 100 indicating the current download state of media files | 290 // progress is a value from 0 to 100 indicating the current download state of media files |
287 }; | 291 }; |
288 this.startPlayback = function() | 292 this.startPlayback = function() |
289 { | 293 { |
290 // Called when playback has begun | 294 // Called when playback has begun |
295 this.play.setAttribute("playstate","playing"); | |
291 $(".track-slider").removeClass('track-slider-playing'); | 296 $(".track-slider").removeClass('track-slider-playing'); |
292 $(this.holder).addClass('track-slider-playing'); | 297 $(this.holder).addClass('track-slider-playing'); |
293 var outsideReference = document.getElementById('outside-reference'); | 298 var outsideReference = document.getElementById('outside-reference'); |
294 if (outsideReference != null) { | 299 if (outsideReference != null) { |
295 $(outsideReference).removeClass('track-slider-playing'); | 300 $(outsideReference).removeClass('track-slider-playing'); |
296 } | 301 } |
297 }; | 302 }; |
298 this.stopPlayback = function() | 303 this.stopPlayback = function() |
299 { | 304 { |
300 // Called when playback has stopped. This gets called even if playback never started! | 305 // Called when playback has stopped. This gets called even if playback never started! |
306 this.play.setAttribute("playstate","ready"); | |
301 $(this.holder).removeClass('track-slider-playing'); | 307 $(this.holder).removeClass('track-slider-playing'); |
302 }; | 308 }; |
303 this.getValue = function() | 309 this.getValue = function() |
304 { | 310 { |
305 // Return the current value of the object. If there is no value, return 0 | 311 // Return the current value of the object. If there is no value, return 0 |