OLD | NEW |
1 var consoleDiv = null; | 1 var consoleDiv = null; |
2 | 2 |
3 function consoleWrite(text) | 3 function consoleWrite(text) |
4 { | 4 { |
5 if (!consoleDiv && document.body) { | 5 if (!consoleDiv && document.body) { |
6 consoleDiv = document.createElement('div'); | 6 consoleDiv = document.createElement('div'); |
7 document.body.appendChild(consoleDiv); | 7 document.body.appendChild(consoleDiv); |
8 } | 8 } |
9 var span = document.createElement('span'); | 9 var span = document.createElement('span'); |
10 span.appendChild(document.createTextNode(text)); | 10 span.appendChild(document.createTextNode(text)); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // Play the specified |content| on |video|. Returns a promise that is resolved | 284 // Play the specified |content| on |video|. Returns a promise that is resolved |
285 // after the video plays for |duration| seconds. | 285 // after the video plays for |duration| seconds. |
286 function playVideoAndWaitForTimeupdate(video, content, duration) | 286 function playVideoAndWaitForTimeupdate(video, content, duration) |
287 { | 287 { |
288 video.src = content; | 288 video.src = content; |
289 video.play(); | 289 video.play(); |
290 return new Promise(function(resolve) { | 290 return new Promise(function(resolve) { |
291 video.addEventListener('timeupdate', function listener(event) { | 291 video.addEventListener('timeupdate', function listener(event) { |
292 if (event.target.currentTime < duration) | 292 if (event.target.currentTime < duration) |
293 return; | 293 return; |
294 video.removeEventListener(listener); | 294 video.removeEventListener('timeupdate', listener); |
295 resolve('success'); | 295 resolve('success'); |
296 }); | 296 }); |
297 }); | 297 }); |
298 } | 298 } |
OLD | NEW |