Mercurial > hg > webaudioevaluationtool
comparison interfaces/AB.js @ 1376:7af61d6fd41b
Bug #1567: AB.js interfaces, the playback toggle now controls both playback start and playback stop commands. Button text updated to reflect.
author | Nicholas Jillings <nickjillings@users.noreply.github.com> |
---|---|
date | Thu, 11 Feb 2016 14:16:09 +0000 |
parents | c277da1e89ca |
children | a4ad9e55b5b8 |
comparison
equal
deleted
inserted
replaced
1375:1350a66ae142 | 1376:7af61d6fd41b |
---|---|
216 } | 216 } |
217 obj.parent.metric.moved(time,obj.value); | 217 obj.parent.metric.moved(time,obj.value); |
218 } | 218 } |
219 console.log("Selected "+id+' ('+time+')'); | 219 console.log("Selected "+id+' ('+time+')'); |
220 }; | 220 }; |
221 this.playback.setAttribute("playstate","ready"); | |
221 this.playback.onclick = function(event) | 222 this.playback.onclick = function(event) |
222 { | 223 { |
223 var id = event.currentTarget.parentElement.getAttribute('track-id'); | 224 var id = event.currentTarget.parentElement.getAttribute('track-id'); |
224 audioEngineContext.play(id); | 225 if (event.currentTarget.getAttribute("playstate") == "ready") |
226 { | |
227 audioEngineContext.play(id); | |
228 } else if (event.currentTarget.getAttribute("playstate") == "playing") { | |
229 audioEngineContext.stop(); | |
230 } | |
231 | |
225 }; | 232 }; |
226 | 233 |
227 this.enable = function() | 234 this.enable = function() |
228 { | 235 { |
229 if (this.parent.state == 1) | 236 if (this.parent.state == 1) |
238 { | 245 { |
239 progress = String(progress); | 246 progress = String(progress); |
240 progress = progress.split('.')[0]; | 247 progress = progress.split('.')[0]; |
241 this.playback.textContent = progress+'%'; | 248 this.playback.textContent = progress+'%'; |
242 } else { | 249 } else { |
243 this.playback.textContent = "Listen"; | 250 this.playback.textContent = "Play"; |
244 } | 251 } |
245 }; | 252 }; |
246 this.startPlayback = function() | 253 this.startPlayback = function() |
247 { | 254 { |
248 $('.comparitor-button').text('Listen'); | 255 $('.comparitor-button').text('Listen'); |
249 $(this.playback).text('Playing'); | 256 $(this.playback).text('Stop'); |
257 this.playback.setAttribute("playstate","playing"); | |
250 }; | 258 }; |
251 this.stopPlayback = function() | 259 this.stopPlayback = function() |
252 { | 260 { |
253 $(this.playback).text('Listen'); | 261 $(this.playback).text('Listen'); |
262 this.playback.setAttribute("playstate","ready"); | |
254 }; | 263 }; |
255 this.exportXMLDOM = function(audioObject) | 264 this.exportXMLDOM = function(audioObject) |
256 { | 265 { |
257 var node = storage.document.createElement('value'); | 266 var node = storage.document.createElement('value'); |
258 node.textContent = this.value; | 267 node.textContent = this.value; |