Index: LayoutTests/media/video-capture-preview.html |
diff --git a/LayoutTests/media/video-capture-preview.html b/LayoutTests/media/video-capture-preview.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fe7d08f3c5c6f93c2c08cc38f5e0366dc8960af5 |
--- /dev/null |
+++ b/LayoutTests/media/video-capture-preview.html |
@@ -0,0 +1,69 @@ |
+<!DOCTYPE HTML"> |
+<html> |
+<head> |
+<script src=media-file.js></script> |
+<script src=video-test.js></script> |
+<script src=video-played.js></script> |
+ |
+<script type="text/javascript"> |
+ |
+var previewURL = ""; |
+var localStream = null; |
+ |
+if (window.internals) |
+ window.internals.settings.setMediaPlaybackRequiresUserGesture(true); |
+ |
+function startPreview() |
+{ |
+ video.src = previewURL; |
+} |
+ |
+function gotStream(stream) |
+{ |
+ consoleWrite("got a stream"); |
+ previewURL = URL.createObjectURL(stream); |
+ startPreview(); |
+ consoleWrite("start preview"); |
+ localStream = stream; |
+ var playTimeInMillisecond = 2500; |
+ var replayIfTimeIsReached = function () |
+ { |
+ startPreview(); |
+ consoleWrite("restart preview"); |
+ setTimeout(endTest, playTimeInMillisecond); |
+ } |
+ |
+ setTimeout(replayIfTimeIsReached, playTimeInMillisecond); |
+} |
+ |
+function gotStreamFailed(error) |
+{ |
+ consoleWrite("Failed to get access to local media. Error code was " + error.code); |
+} |
+ |
+function playPreview() |
+{ |
+ findMediaElement(); |
+ try { |
+ consoleWrite("request access to local media"); |
+ navigator.webkitGetUserMedia({video:true}, gotStream, gotStreamFailed); |
+ } catch (e) { |
+ consoleWrite("getUserMedia error " + "(" + e.name + " / " + e.message + ")"); |
+ } |
+ |
+ waitForEvent("error"); |
+ waitForEvent("loadstart"); |
+ waitForEvent("loadeddata"); |
+ waitForEvent("canplay"); |
+ waitForEvent("play"); |
+ waitForEvent("canplaythrough"); |
+} |
+ |
+</script> |
+</head> |
+ |
+<body onload="playPreview()"> |
+<video width="320" height="240" autoplay="autoplay"></video> |
+</body> |
+</html> |
+ |