OLD | NEW |
| (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 | |
8 <script type="text/javascript"> | |
9 | |
10 var previewURL = ""; | |
11 var localStream = null; | |
12 | |
13 if (window.internals) | |
14 window.internals.settings.setMediaPlaybackRequiresUserGesture(true); | |
15 | |
16 function startPreview() | |
17 { | |
18 video.src = previewURL; | |
19 } | |
20 | |
21 function gotStream(stream) | |
22 { | |
23 consoleWrite("got a stream"); | |
24 previewURL = URL.createObjectURL(stream); | |
25 startPreview(); | |
26 consoleWrite("start preview"); | |
27 localStream = stream; | |
28 var playTimeInMillisecond = 2500; | |
29 var replayIfTimeIsReached = function () | |
30 { | |
31 startPreview(); | |
32 consoleWrite("restart preview"); | |
33 setTimeout(endTest, playTimeInMillisecond); | |
34 } | |
35 | |
36 setTimeout(replayIfTimeIsReached, playTimeInMillisecond); | |
37 } | |
38 | |
39 function gotStreamFailed(error) | |
40 { | |
41 consoleWrite("Failed to get access to local media. Error code was " + error.
code); | |
42 } | |
43 | |
44 function playPreview() | |
45 { | |
46 findMediaElement(); | |
47 try { | |
48 consoleWrite("request access to local media"); | |
49 navigator.webkitGetUserMedia({video:true}, gotStream, gotStreamFailed); | |
50 } catch (e) { | |
51 consoleWrite("getUserMedia error " + "(" + e.name + " / " + e.message +
")"); | |
52 } | |
53 | |
54 waitForEvent("error"); | |
55 waitForEvent("loadstart"); | |
56 waitForEvent("loadeddata"); | |
57 waitForEvent("canplay"); | |
58 waitForEvent("play"); | |
59 waitForEvent("canplaythrough"); | |
60 } | |
61 | |
62 </script> | |
63 </head> | |
64 | |
65 <body onload="playPreview()"> | |
66 <video width="320" height="240" autoplay="autoplay"></video> | |
67 </body> | |
68 </html> | |
69 | |
OLD | NEW |