| 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 |
| 11 setAllEventsOccuredHandler(function() { | 11 setAllEventsOccuredHandler(function() { |
| 12 gLocalStream.stop(); | 12 gLocalStream.stop(); |
| 13 reportTestSuccess(); | 13 reportTestSuccess(); |
| 14 }); | 14 }); |
| 15 | 15 |
| 16 function getMediaDevices() { | 16 function getSources() { |
| 17 navigator.getMediaDevices(function(devices) { | 17 MediaStreamTrack.getSources(function(devices) { |
| 18 document.title = 'Media devices available'; | 18 document.title = 'Media devices available'; |
| 19 sendValueToTest(JSON.stringify(devices)); | 19 sendValueToTest(JSON.stringify(devices)); |
| 20 }); | 20 }); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Creates a MediaStream and renders it locally. When the video is detected to | 23 // Creates a MediaStream and renders it locally. When the video is detected to |
| 24 // be rolling, the stream should be stopped. | 24 // be rolling, the stream should be stopped. |
| 25 function getUserMediaAndStop(constraints) { | 25 function getUserMediaAndStop(constraints) { |
| 26 console.log('Calling getUserMediaAndStop.'); | 26 console.log('Calling getUserMediaAndStop.'); |
| 27 navigator.webkitGetUserMedia( | 27 navigator.webkitGetUserMedia( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 function(aspectRatio) { | 213 function(aspectRatio) { |
| 214 result = result + '-' + aspectRatio; | 214 result = result + '-' + aspectRatio; |
| 215 sendValueToTest(result); | 215 sendValueToTest(result); |
| 216 }, | 216 }, |
| 217 'local-view-2'); | 217 'local-view-2'); |
| 218 }, | 218 }, |
| 219 failedCallback); | 219 failedCallback); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Calls GetUserMedia twice and verify that the frame rate is as expected for | 223 // Calls GetUserMedia twice and verify that the frame rate is as expected for |
| 224 // both streams. | 224 // both streams. |
| 225 function twoGetUserMediaAndVerifyFrameRate(constraints1, | 225 function twoGetUserMediaAndVerifyFrameRate(constraints1, |
| 226 constraints2, | 226 constraints2, |
| 227 expected_frame_rate1, | 227 expected_frame_rate1, |
| 228 expected_frame_rate2) { | 228 expected_frame_rate2) { |
| 229 addExpectedEvent(); | 229 addExpectedEvent(); |
| 230 addExpectedEvent(); | 230 addExpectedEvent(); |
| 231 var validateFrameRateCallback = function (success) { | 231 var validateFrameRateCallback = function (success) { |
| 232 if (!success) | 232 if (!success) |
| 233 failTest("Failed to validate frameRate."); | 233 failTest("Failed to validate frameRate."); |
| 234 eventOccured(); | 234 eventOccured(); |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 navigator.webkitGetUserMedia( | 237 navigator.webkitGetUserMedia( |
| 238 constraints1, | 238 constraints1, |
| 239 function(stream) { | 239 function(stream) { |
| 240 requestSecondGetUserMedia(); | 240 requestSecondGetUserMedia(); |
| 241 plugStreamIntoVideoElement(stream, 'local-view'); | 241 plugStreamIntoVideoElement(stream, 'local-view'); |
| 242 detectVideoPlaying('local-view', | 242 detectVideoPlaying('local-view', |
| 243 function() { | 243 function() { |
| 244 validateFrameRate('local-view', expected_frame_rate1, | 244 validateFrameRate('local-view', expected_frame_rate1, |
| 245 validateFrameRateCallback); | 245 validateFrameRateCallback); |
| 246 }); | 246 }); |
| 247 }, | 247 }, |
| 248 failedCallback); | 248 failedCallback); |
| 249 var requestSecondGetUserMedia = function() { | 249 var requestSecondGetUserMedia = function() { |
| 250 navigator.webkitGetUserMedia( | 250 navigator.webkitGetUserMedia( |
| 251 constraints2, | 251 constraints2, |
| 252 function(stream) { | 252 function(stream) { |
| 253 plugStreamIntoVideoElement(stream, 'local-view-2'); | 253 plugStreamIntoVideoElement(stream, 'local-view-2'); |
| 254 detectVideoPlaying('local-view-2', | 254 detectVideoPlaying('local-view-2', |
| 255 function() { | 255 function() { |
| 256 validateFrameRate('local-view-2', expected_frame_rate2, | 256 validateFrameRate('local-view-2', expected_frame_rate2, |
| 257 validateFrameRateCallback); | 257 validateFrameRateCallback); |
| 258 }); | 258 }); |
| 259 }, | 259 }, |
| 260 failedCallback); | 260 failedCallback); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 function failedCallback(error) { | 264 function failedCallback(error) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 <tr> | 463 <tr> |
| 464 <td><video width="320" height="240" id="local-view-2" | 464 <td><video width="320" height="240" id="local-view-2" |
| 465 autoplay="autoplay"></video></td> | 465 autoplay="autoplay"></video></td> |
| 466 <!-- Canvases are named after their corresponding video elements. --> | 466 <!-- Canvases are named after their corresponding video elements. --> |
| 467 <td><canvas width="320" height="240" id="local-view-2-canvas" | 467 <td><canvas width="320" height="240" id="local-view-2-canvas" |
| 468 style="display:none"></canvas></td> | 468 style="display:none"></canvas></td> |
| 469 </tr> | 469 </tr> |
| 470 </table> | 470 </table> |
| 471 </body> | 471 </body> |
| 472 </html> | 472 </html> |
| OLD | NEW |