| OLD | NEW |
| 1 var console = null; | 1 var consoleDiv = null; |
| 2 | 2 |
| 3 function consoleWrite(text) | 3 function consoleWrite(text) |
| 4 { | 4 { |
| 5 if (!console && document.body) { | 5 if (!consoleDiv && document.body) { |
| 6 console = document.createElement('div'); | 6 consoleDiv = document.createElement('div'); |
| 7 document.body.appendChild(console); | 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)); |
| 11 span.appendChild(document.createElement('br')); | 11 span.appendChild(document.createElement('br')); |
| 12 console.appendChild(span); | 12 consoleDiv.appendChild(span); |
| 13 } | 13 } |
| 14 | 14 |
| 15 // Returns a promise that is fulfilled with true if |initDataType| is supported, | 15 // Returns a promise that is fulfilled with true if |initDataType| is supported, |
| 16 // or false if not. | 16 // or false if not. |
| 17 function isInitDataTypeSupported(initDataType) | 17 function isInitDataTypeSupported(initDataType) |
| 18 { | 18 { |
| 19 return navigator.requestMediaKeySystemAccess( | 19 return navigator.requestMediaKeySystemAccess( |
| 20 "org.w3.clearkey", [{ initDataTypes : [initDataType] }]
) | 20 "org.w3.clearkey", [{ initDataTypes : [initDataType] }]
) |
| 21 .then(function() { return(true); }, function() { return(false); }); | 21 .then(function() { return(true); }, function() { return(false); }); |
| 22 } | 22 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(listener); |
| 295 resolve('success'); | 295 resolve('success'); |
| 296 }); | 296 }); |
| 297 }); | 297 }); |
| 298 } | 298 } |
| OLD | NEW |