OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 $ = function(id) { | 5 $ = function(id) { |
6 return document.getElementById(id); | 6 return document.getElementById(id); |
7 }; | 7 }; |
8 | 8 |
9 var gLocalStream = null; | 9 var gLocalStream = null; |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 createAndRenderClone, failedCallback); | 64 createAndRenderClone, failedCallback); |
65 } | 65 } |
66 | 66 |
67 function failedCallback(error) { | 67 function failedCallback(error) { |
68 document.title = 'GetUserMedia call failed with code ' + error.code; | 68 document.title = 'GetUserMedia call failed with code ' + error.code; |
69 sendValueToTest(document.title); | 69 sendValueToTest(document.title); |
70 } | 70 } |
71 | 71 |
72 function plugStreamIntoLocalView(stream) { | 72 function plugStreamIntoLocalView(stream) { |
73 gLocalStream = stream; | 73 gLocalStream = stream; |
74 var localStreamUrl = webkitURL.createObjectURL(stream); | 74 var localStreamUrl = URL.createObjectURL(stream); |
75 $('local-view').src = localStreamUrl; | 75 $('local-view').src = localStreamUrl; |
76 } | 76 } |
77 | 77 |
78 function displayAndDetectVideo(stream, callback) { | 78 function displayAndDetectVideo(stream, callback) { |
79 plugStreamIntoLocalView(stream); | 79 plugStreamIntoLocalView(stream); |
80 document.title = 'Waiting for video...'; | 80 document.title = 'Waiting for video...'; |
81 detectVideoPlaying('local-view', callback); | 81 detectVideoPlaying('local-view', callback); |
82 } | 82 } |
83 | 83 |
84 function displayDetectAndAnalyzeVideo(stream) { | 84 function displayDetectAndAnalyzeVideo(stream) { |
85 plugStreamIntoLocalView(stream); | 85 plugStreamIntoLocalView(stream); |
86 analyzeVideo(); | 86 analyzeVideo(); |
87 } | 87 } |
88 | 88 |
89 function createAndRenderClone(stream) { | 89 function createAndRenderClone(stream) { |
90 gLocalStream = stream; | 90 gLocalStream = stream; |
91 // TODO(perkj): --use-fake-device-for-media-stream do not currently | 91 // TODO(perkj): --use-fake-device-for-media-stream do not currently |
92 // work with audio devices and not all bots has a microphone. | 92 // work with audio devices and not all bots has a microphone. |
93 new_stream = new webkitMediaStream(); | 93 new_stream = new webkitMediaStream(); |
94 new_stream.addTrack(stream.getVideoTracks()[0]); | 94 new_stream.addTrack(stream.getVideoTracks()[0]); |
95 expectEquals(new_stream.getVideoTracks().length, 1); | 95 expectEquals(new_stream.getVideoTracks().length, 1); |
96 if (stream.getAudioTracks().length > 0) { | 96 if (stream.getAudioTracks().length > 0) { |
97 new_stream.addTrack(stream.getAudioTracks()[0]); | 97 new_stream.addTrack(stream.getAudioTracks()[0]); |
98 expectEquals(new_stream.getAudioTracks().length, 1); | 98 expectEquals(new_stream.getAudioTracks().length, 1); |
99 new_stream.removeTrack(new_stream.getAudioTracks()[0]); | 99 new_stream.removeTrack(new_stream.getAudioTracks()[0]); |
100 expectEquals(new_stream.getAudioTracks().length, 0); | 100 expectEquals(new_stream.getAudioTracks().length, 0); |
101 } | 101 } |
102 | 102 |
103 var newStreamUrl = webkitURL.createObjectURL(new_stream); | 103 var newStreamUrl = URL.createObjectURL(new_stream); |
104 $('local-view').src = newStreamUrl; | 104 $('local-view').src = newStreamUrl; |
105 waitForVideo('local-view'); | 105 waitForVideo('local-view'); |
106 } | 106 } |
107 | 107 |
108 function stopVideoTrack() { | 108 function stopVideoTrack() { |
109 gLocalStream.getVideoTracks()[0].stop(); | 109 gLocalStream.getVideoTracks()[0].stop(); |
110 waitForVideoToStop('local-view'); | 110 waitForVideoToStop('local-view'); |
111 } | 111 } |
112 | 112 |
113 function waitAndStopVideoTrack(waitTimeInSeconds) { | 113 function waitAndStopVideoTrack(waitTimeInSeconds) { |
(...skipping 20 matching lines...) Expand all Loading... |
134 <tr> | 134 <tr> |
135 <td><video width="320" height="240" id="local-view" | 135 <td><video width="320" height="240" id="local-view" |
136 autoplay="autoplay"></video></td> | 136 autoplay="autoplay"></video></td> |
137 <!-- Canvases are named after their corresponding video elements. --> | 137 <!-- Canvases are named after their corresponding video elements. --> |
138 <td><canvas width="320" height="240" id="local-view-canvas" | 138 <td><canvas width="320" height="240" id="local-view-canvas" |
139 style="display:none"></canvas></td> | 139 style="display:none"></canvas></td> |
140 </tr> | 140 </tr> |
141 </table> | 141 </table> |
142 </body> | 142 </body> |
143 </html> | 143 </html> |
OLD | NEW |