Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: content/test/data/media/getusermedia.html

Issue 2956063003: Add support for echoCancellation and deviceId to MediaStreamTrack.getSettings (Closed)
Patch Set: fix DCHECK Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 setAllEventsOccuredHandler(function() { 9 setAllEventsOccuredHandler(function() {
10 reportTestSuccess(); 10 reportTestSuccess();
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 return; 549 return;
550 } 550 }
551 } 551 }
552 552
553 clearInterval(detectorInterval); 553 clearInterval(detectorInterval);
554 var result = "w=" + width + ":h=" + height; 554 var result = "w=" + width + ":h=" + height;
555 callback(result); 555 callback(result);
556 } 556 }
557 var detectorInterval = setInterval(detectorFunction, 50); 557 var detectorInterval = setInterval(detectorFunction, 50);
558 } 558 }
559
560 function getAudioSettingsDefault() {
561 navigator.mediaDevices.getUserMedia({audio:true})
562 .then(stream => {
563 assertEquals(stream.getAudioTracks().length, 1);
564 var settings = stream.getAudioTracks()[0].getSettings();
565 assertEquals(settings.deviceId, 'default');
566 assertTrue(settings.echoCancellation);
567 stream.getAudioTracks()[0].stop();
568 reportTestSuccess();
569 })
570 .catch(_=>{
571 failTest("getUserMedia failed")
572 });
573 }
574
575 function getAudioSettingsNoEchoCancellation() {
576 navigator.mediaDevices.getUserMedia({audio:{echoCancellation: false}})
577 .then(stream => {
578 assertEquals(stream.getAudioTracks().length, 1);
579 var settings = stream.getAudioTracks()[0].getSettings();
580 assertEquals(settings.deviceId, 'default');
581 assertEquals(settings.echoCancellation, false);
582 stream.getAudioTracks()[0].stop();
583 reportTestSuccess();
584 })
585 .catch(_=>{
586 failTest("getUserMedia failed")
587 });
588 }
589
590 function getAudioSettingsDeviceId() {
591 navigator.mediaDevices.enumerateDevices()
592 .then(devices => {
593 var last_device_id;
594 for (var device, i = 0; device = devices[i]; ++i) {
595 if (device.kind != "audioinput")
596 continue;
597 last_device_id = device.deviceId;
598 }
599 navigator.mediaDevices.getUserMedia(
600 {audio:{deviceId: {exact: last_device_id}}})
601 .then(stream => {
602 assertEquals(stream.getAudioTracks().length, 1);
603 var settings = stream.getAudioTracks()[0].getSettings();
604 assertEquals(settings.deviceId, last_device_id);
605 assertNotEquals(settings.deviceId, 'default');
606 assertTrue(settings.echoCancellation);
607 stream.getAudioTracks()[0].stop();
608 reportTestSuccess();
609 })
610 })
611 .catch(e => {
612 failTest("Unexpected error: " + e)
613 });
614 }
559 </script> 615 </script>
560 </head> 616 </head>
561 <body> 617 <body>
562 <table border="0"> 618 <table border="0">
563 <!-- Canvases are named after their corresponding video elements. --> 619 <!-- Canvases are named after their corresponding video elements. -->
564 <tr> 620 <tr>
565 <td><video id="local-view-1" width="320" height="240" autoplay 621 <td><video id="local-view-1" width="320" height="240" autoplay
566 style="display:none"></video></td> 622 style="display:none"></video></td>
567 <td><canvas id="local-view-1-canvas" width="320" height="240" 623 <td><canvas id="local-view-1-canvas" width="320" height="240"
568 style="display:none"></canvas></td> 624 style="display:none"></canvas></td>
569 </tr> 625 </tr>
570 <tr> 626 <tr>
571 <td><video id="local-view-2" width="320" height="240" autoplay 627 <td><video id="local-view-2" width="320" height="240" autoplay
572 style="display:none"></video></td> 628 style="display:none"></video></td>
573 <td><canvas id="local-view-2-canvas" width="320" height="240" 629 <td><canvas id="local-view-2-canvas" width="320" height="240"
574 style="display:none"></canvas></td> 630 style="display:none"></canvas></td>
575 </tr> 631 </tr>
576 </table> 632 </table>
577 </body> 633 </body>
578 </html> 634 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698