| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>A muted audio track that is added should not cause audio to be sent</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script src ="routines.js"></script> |
| <script> |
| promise_test((test) => { |
| if (window.testRunner) |
| testRunner.setUserMediaPermission(true); |
| |
| var localTrack; |
| return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => { |
| localTrack = localStream.getAudioTracks()[0]; |
| localTrack.enabled = false; |
| var remoteStream; |
| return new Promise((resolve, reject) => { |
| createConnections((firstConnection) => { |
| firstConnection.addTrack(localTrack, localStream); |
| }, (secondConnection) => { |
| secondConnection.ontrack = (trackEvent) => { |
| remoteStream = trackEvent.streams[0]; |
| resolve(); |
| }; |
| }); |
| }).then(() => { |
| return doHumAnalysis(remoteStream, false).then((result) => { |
| assert_true(result, "Should not hear hum"); |
| }); |
| }).then(() => { |
| localTrack.enabled = true; |
| }).then(() => { |
| return doHumAnalysis(remoteStream, true).then((result) => { |
| assert_true(result, "Should hear hum"); |
| }); |
| }); |
| }); |
| }, "Muting a local audio track before adding it should be correctly handled"); |
| </script> |
| </body> |
| </html> |