| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <video id="video" autoplay="true" loop> | 4 <video id="video" loop></video> |
| 5 <source type="video/mp4"> | |
| 6 </video> | |
| 7 <script src="../resources/runner.js"></script> | 5 <script src="../resources/runner.js"></script> |
| 8 <script src="resources/canvas_runner.js"></script> | 6 <script src="resources/canvas_runner.js"></script> |
| 9 <script> | 7 <script> |
| 10 var videoElement = document.getElementById("video"); | 8 var videoElement = document.getElementById("video"); |
| 11 var destCanvas2D = document.createElement("canvas"); | 9 var destCanvas2D = document.createElement("canvas"); |
| 12 var destCtx2D = destCanvas2D.getContext("2d"); | 10 var destCtx2D = destCanvas2D.getContext("2d"); |
| 13 | 11 |
| 14 function setSize(width, height) { | 12 function setSize(width, height) { |
| 15 destCanvas2D.width = width; | 13 destCanvas2D.width = width; |
| 16 destCanvas2D.height = height; | 14 destCanvas2D.height = height; |
| 17 } | 15 } |
| 18 | 16 |
| 19 function addPlayCallback(videoElement) { | 17 function addPlayCallback(videoElement) { |
| 20 // This logic makes sure this perf test starts after playing the video. | 18 // This logic makes sure this perf test starts after playing the video. |
| 21 videoElement.addEventListener("canplaythrough", startVideo, true); | 19 videoElement.addEventListener("canplaythrough", startVideo, true); |
| 22 videoElement.addEventListener("play", startPerfTest, true); | 20 videoElement.addEventListener("play", startPerfTest, true); |
| 23 videoElement.src = "../resources/720x576i-anamorphic.mov"; | 21 videoElement.addEventListener('error', function(ev) { |
| 22 CanvasRunner.logFatalError("\nmp4 codec is not supported on this platfor
m. Received error event:" + ev.target.error.code + "\n"); |
| 23 }, false); |
| 24 videoElement.src = "../resources/bear-1280x720.mp4"; |
| 24 } | 25 } |
| 25 | 26 |
| 26 function startVideo() { | 27 function startVideo() { |
| 27 // loop can emit this event again. | 28 // loop can emit this event again. |
| 28 videoElement.removeEventListener("canplaythrough", startVideo, true); | 29 videoElement.removeEventListener("canplaythrough", startVideo, true); |
| 29 videoElement.play(); | 30 videoElement.play(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 function startPerfTest() { | 33 function startPerfTest() { |
| 33 CanvasRunner.start({ | 34 CanvasRunner.start({ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 51 // It should use setMinimumAccelerated2dCanvasSize() to enable accelerated C
anvas for a specified size | 52 // It should use setMinimumAccelerated2dCanvasSize() to enable accelerated C
anvas for a specified size |
| 52 // but this API is not available in JS or WebPage. Assume the threshold size
is 256x257 | 53 // but this API is not available in JS or WebPage. Assume the threshold size
is 256x257 |
| 53 // and the dest canvas is HW accelerated Canvas when setting its size to 102
4x1024. | 54 // and the dest canvas is HW accelerated Canvas when setting its size to 102
4x1024. |
| 54 setSize(1024, 1024); | 55 setSize(1024, 1024); |
| 55 addPlayCallback(videoElement); | 56 addPlayCallback(videoElement); |
| 56 } | 57 } |
| 57 | 58 |
| 58 </script> | 59 </script> |
| 59 </body> | 60 </body> |
| 60 </html> | 61 </html> |
| OLD | NEW |