blob: 1ba5d33772ae9b9191d916a1ea3a6011e86a1629 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Testing web audio on peer connection audio tracks</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
var context = new webkitAudioContext();
promise_test((test) => {
return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
var remoteTrack;
var remoteStream;
return new Promise((resolve, reject) => {
createConnections((firstConnection) => {
firstConnection.addTrack(localStream.getAudioTracks()[0]);
}, (secondConnection) => {
secondConnection.ontrack = (trackEvent) => {
remoteStream = trackEvent.streams[0];
remoteTrack = remoteStream.getAudioTracks()[0];
resolve();
};
});
}).then(() => {
return doHumAnalysis(remoteStream, true);
}).then((value) => {
assert_true(value, "heard hum from remote enabled track");
}).then(() => {
remoteTrack.enabled = false;
return doHumAnalysis(remoteStream, false);
}).then((value) => {
assert_true(value, "not heard hum from remote disabled track");
}).then(() => {
remoteTrack.enabled = true;
return doHumAnalysis(remoteStream, true);
}).then((value) => {
assert_true(value, "heard hum from remote reenabled track");
}).then(() => {
return context.close();
});
});
}, "Muting and unmuting an incoming audio track");
</script>
</body>
</html>