blob: ccd2eb29d4f54c9ab604586b9da32199316901f0 [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], localStream);
}, (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>