OLD | NEW |
| 1 <!doctype html> |
1 <html> | 2 <html> |
2 <body onload="start()"> | 3 <body onload="start()"> |
3 <script src=../../media-resources/video-test.js></script> | 4 <script src=../../media-resources/video-test.js></script> |
4 <script src=../../media-resources/media-file.js></script> | 5 <script src=../../media-resources/media-file.js></script> |
5 <script> | 6 <script> |
6 waitForEvent('error', function() { | 7 waitForEvent('error', function() { |
7 failTest("error: " + JSON.stringify(video.error)); | 8 failTest("error: " + JSON.stringify(video.error)); |
8 }); | 9 }); |
9 | 10 |
10 waitForEvent('playing', function() { | 11 waitForEvent('playing', function() { |
11 try { | 12 try { |
12 var ctx = document.getElementsByTagName('canvas')[0].getContext("2
d"); | 13 var ctx = document.getElementsByTagName('canvas')[0].getContext("2
d"); |
13 ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); | 14 ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); |
14 ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); | 15 ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); |
15 } catch (e) { | 16 } catch (e) { |
16 failTest("Caught error: " + e); | 17 failTest("Caught error: " + e); |
17 } | 18 } |
18 endTest(); | 19 endTest(); |
19 }); | 20 }); |
20 | 21 |
21 function start() { | 22 function start() { |
22 findMediaElement(); | 23 mediaElement = video = document.createElement("video"); |
| 24 mediaElement.crossOrigin = "anonymous"; |
| 25 document.body.appendChild(mediaElement); |
23 var mediaFile = findMediaFile("video", "../../media/resources/test")
; | 26 var mediaFile = findMediaFile("video", "../../media/resources/test")
; |
24 var type = mimeTypeForExtension(mediaFile.split('.').pop()); | 27 var type = mimeTypeForExtension(mediaFile.split('.').pop()); |
25 video.src = "http://localhost:8080/security/resources/video-cross-or
igin-allow.php?name=" + mediaFile + "&type=" + type; | 28 video.src = "http://localhost:8080/security/resources/video-cross-or
igin-allow.php?no-preflight&name=" + mediaFile + "&type=" + type; |
26 video.play(); | 29 video.play(); |
27 } | 30 } |
28 </script> | 31 </script> |
29 | |
30 <video crossorigin></video> | |
31 <canvas></canvas> | 32 <canvas></canvas> |
32 </body> | 33 </body> |
33 </head> | 34 </head> |
OLD | NEW |