Index: content/test/data/media/getusermedia.html |
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html |
index 14ce8d5755df0ef0e87e984232cbd8ece99066bc..80f57883ded5b52b13a43eb15637dda8abedfa92 100644 |
--- a/content/test/data/media/getusermedia.html |
+++ b/content/test/data/media/getusermedia.html |
@@ -5,19 +5,19 @@ |
$ = function(id) { |
return document.getElementById(id); |
}; |
- |
+ |
var gLocalStream = null; |
- |
+ |
setAllEventsOccuredHandler(function() { |
gLocalStream.stop(); |
- document.title = 'OK'; |
+ document.title = 'OK'; |
}); |
- |
- // This test that a MediaStream can be created and a local preview |
+ |
+ // This test that a MediaStream can be created and a local preview |
// rendered. |
function getUserMedia(constraints) { |
- navigator.webkitGetUserMedia(constraints, displayAndWaitForVideo, |
- failedCallback); |
+ navigator.webkitGetUserMedia(constraints, |
+ displayAndWaitForVideoToStartAndStop, failedCallback); |
} |
function getUserMediaWithAnalysis(constraints) { |
@@ -25,22 +25,23 @@ |
constraints, displayAndWaitForAndAnalyzeVideo, failedCallback); |
} |
- // This test that a MediaStream can be cloned and that the clone can |
+ // This test that a MediaStream can be cloned and that the clone can |
// be rendered. |
function getUserMediaAndClone() { |
navigator.webkitGetUserMedia({video: true, audio: true}, |
createAndRenderClone, failedCallback); |
} |
- |
+ |
function failedCallback(error) { |
document.title = 'GetUserMedia call failed with code ' + error.code; |
} |
- function displayAndWaitForVideo(stream) { |
+ function displayAndWaitForVideoToStartAndStop(stream) { |
gLocalStream = stream; |
var localStreamUrl = webkitURL.createObjectURL(stream); |
$('local-view').src = localStreamUrl; |
- waitForVideo('local-view'); |
+ document.title = 'Waiting for video...'; |
+ detectVideoIn('local-view', stopVideoTrack); |
phoglund_chromium
2013/11/14 09:01:18
This doesn't read very intuitively since IMO it lo
perkj_chrome
2013/11/14 13:29:07
Done.
|
} |
function displayAndWaitForAndAnalyzeVideo(stream) { |
@@ -53,7 +54,7 @@ |
function createAndRenderClone(stream) { |
gLocalStream = stream; |
// TODO(perkj): --use-fake-device-for-media-stream do not currently |
- // work with audio devices and not all bots has a microphone. |
+ // work with audio devices and not all bots has a microphone. |
new_stream = new webkitMediaStream(); |
new_stream.addTrack(stream.getVideoTracks()[0]); |
expectEquals(new_stream.getVideoTracks().length, 1); |
@@ -63,12 +64,17 @@ |
new_stream.removeTrack(new_stream.getAudioTracks()[0]); |
expectEquals(new_stream.getAudioTracks().length, 0); |
} |
- |
+ |
var newStreamUrl = webkitURL.createObjectURL(new_stream); |
- $('local-view').src = newStreamUrl; |
+ $('local-view').src = newStreamUrl; |
waitForVideo('local-view'); |
} |
+ function stopVideoTrack() { |
+ waitForVideoToStop('local-view'); |
phoglund_chromium
2013/11/14 09:01:18
You should be able to swap this statement and the
perkj_chrome
2013/11/14 13:29:07
Done.
|
+ gLocalStream.getVideoTracks()[0].stop(); |
+ } |
+ |
function analyzeVideo() { |
document.title = 'Waiting for video...'; |
addExpectedEvent(); |
@@ -78,7 +84,7 @@ |
}); |
} |
- </script> |
+ </script> |
</head> |
<body> |
<table border="0"> |
@@ -87,7 +93,7 @@ |
</tr> |
<tr> |
<td><video width="320" height="240" id="local-view" |
- autoplay="autoplay"></video></td> |
+ autoplay="autoplay"></video></td> |
<!-- Canvases are named after their corresponding video elements. --> |
<td><canvas width="320" height="240" id="local-view-canvas" |
style="display:none"></canvas></td> |