Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Side by Side Diff: LayoutTests/media/video-capture-canvas.html

Issue 428263004: Revert of Delete mediaPlaybackRequiresUserGesture (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML">
2 <html>
3 <head>
4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
6 <script src=video-played.js></script>
7 <script src="../resources/js-test.js"></script>
8
9 <script type="text/javascript">
10
11 if (window.internals)
12 window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
13
14 function gotStream(stream)
15 {
16 consoleWrite("got a stream");
17 previewURL = URL.createObjectURL(stream);
18 video.src = previewURL;
19 consoleWrite("start preview");
20 }
21
22 function gotStreamFailed(error)
23 {
24 consoleWrite("Failed to get access to local media. Error code was " + error. code);
25 }
26
27 function canplaythrough()
28 {
29 width = canvas.width;
30 height = canvas.height;
31 ctx = canvas.getContext("2d");
32 ctx.fillStyle = 'black';
33 ctx.fillRect(0, 0, width, height);
34
35 consoleWrite("paint to canvas");
36 ctx.drawImage(video, 0, 0, width, height);
37 shouldBeTrue("!!ctx.getImageData(0, 0, width, height)");
38
39 frame = ctx.getImageData(0, 0, width, height);
40 r = frame.data[0];
41 g = frame.data[1];
42 b = frame.data[2];
43 testExpected("r+g+b", 0, "!=");
44 endTest();
45 }
46
47 function playPreview()
48 {
49 findMediaElement();
50 canvas = document.getElementsByTagName('canvas')[0];
51 try {
52 consoleWrite("request access to local media");
53 navigator.webkitGetUserMedia({video:true}, gotStream, gotStreamFailed);
54 } catch (e) {
55 consoleWrite("getUserMedia error " + "(" + e.name + " / " + e.message + ")");
56 }
57
58 waitForEvent('canplaythrough', canplaythrough);
59 }
60
61 </script>
62 </head>
63
64 <body onload="playPreview()">
65 <video width="320" height="240" autoplay="autoplay"></video>
66 <canvas width="1" height="1" ></canvas>
67 </body>
68 </html>
69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698