Chromium Code Reviews| Index: content/test/data/media/getusermedia.html |
| diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html |
| index 92037cfb53752b854b205e66e6a1587f8776a1de..32c6c415bdf2b86ea8dea46a17cc144fd733edf5 100644 |
| --- a/content/test/data/media/getusermedia.html |
| +++ b/content/test/data/media/getusermedia.html |
| @@ -64,25 +64,59 @@ |
| createAndRenderClone, failedCallback); |
| } |
| + // Creates two MediaStream and renders them locally. When the video of both |
| + // streams are detected to be rolling, the test succeeds. |
|
phoglund_chromium
2014/01/16 08:22:07
... we stop the local stream. Since both streams h
no longer working on chromium
2014/01/16 13:08:56
Fixed the comment, but actually it is because both
|
| + function twoGetUserMediaAndStop(constraints) { |
| + document.title = 'Calling Two GetUserMedia'; |
| + navigator.webkitGetUserMedia( |
| + constraints, |
| + function(stream) { |
| + displayAndDetectVideo(stream, requestSecondGetUserMedia); |
| + }, |
| + failedCallback); |
| + var requestSecondGetUserMedia = function() { |
| + navigator.webkitGetUserMedia( |
| + constraints, |
| + function(stream) { |
| + displayIntoVideoElement(stream, |
| + stopStreamAndVerifyAllLocalViewsDontPlayVideo, 'local-view-2'); |
| + }, |
| + failedCallback); |
| + }; |
| + |
| + var stopStreamAndVerifyAllLocalViewsDontPlayVideo = function() { |
| + gLocalStream.getVideoTracks()[0].stop(); |
| + |
| + // Since local-view and local-view-2 are playing the video from the same |
| + // source, both of them should stop. |
| + waitForVideoToStop('local-view'); |
| + waitForVideoToStop('local-view-2'); |
| + }; |
| + } |
| + |
| function failedCallback(error) { |
| document.title = 'GetUserMedia call failed with code ' + error.code; |
| sendValueToTest(document.title); |
| } |
| - function plugStreamIntoLocalView(stream) { |
| + function plugStreamIntoVideoElement(stream, videoElement) { |
| gLocalStream = stream; |
| var localStreamUrl = URL.createObjectURL(stream); |
| - $('local-view').src = localStreamUrl; |
| + $(videoElement).src = localStreamUrl; |
| } |
| - function displayAndDetectVideo(stream, callback) { |
| - plugStreamIntoLocalView(stream); |
| + function displayIntoVideoElement(stream, callback, videoElement) { |
| + plugStreamIntoVideoElement(stream, videoElement); |
| document.title = 'Waiting for video...'; |
| - detectVideoPlaying('local-view', callback); |
| + detectVideoPlaying(videoElement, callback); |
| + } |
| + |
| + function displayAndDetectVideo(stream, callback) { |
| + displayIntoVideoElement(stream, callback, 'local-view'); |
| } |
| function displayDetectAndAnalyzeVideo(stream) { |
| - plugStreamIntoLocalView(stream); |
| + plugStreamIntoVideoElement(stream, 'local-view'); |
| analyzeVideo(); |
| } |
| @@ -134,10 +168,19 @@ |
| <tr> |
| <td><video width="320" height="240" id="local-view" |
| 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> |
| </tr> |
| + <tr> |
| + <td>Local Preview 2</td> |
| + </tr> |
| + <tr> |
| + <td><video width="320" height="240" id="local-view-2" |
| + autoplay="autoplay"></video></td> |
| + <!-- Canvases are named after their corresponding video elements. --> |
| + <td><canvas width="320" height="240" id="local-view-2-canvas" |
| + style="display:none"></canvas></td> |
| + </tr> |
| </table> |
| </body> |
| </html> |