blob: 59456c6470b915be972b301b225c117952b80487 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Testing local audio capture playback causes "playing" event to fire</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) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
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 analyseAudio(remoteStream, 200, context).then((results) => {
assert_true(results.heardHum, "heard hum from remote enabled track");
});
}).then(() => {
remoteTrack.enabled = false;
return waitFor(100);
}).then(() => {
return analyseAudio(remoteStream, 200, context).then((results) => {
assert_false(results.heardHum, "not heard hum from remote disabled track");
});
}).then(() => {
return context.close();
});
});
}, "Muting an incoming audio track");
</script>
</body>
</html>