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