blob: ca138be122a55db5865a08341541c74f07b85825 [file] [log] [blame]
<body>
<video id="localVideo" autoplay playsInline></video>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
promise_test(async() => {
if (!window.internals)
return Promise.reject("Test requires internals API");
if (!window.internals.supportsAudioSession)
return;
internals.settings.setShouldManageAudioSessionCategory(true);
let stream = await navigator.mediaDevices.getUserMedia({audio : true});
localVideo.srcObject = stream;
await localVideo.play();
assert_equals(internals.audioSessionCategory(), "PlayAndRecord");
stream.getAudioTracks()[0].enabled = false;
await new Promise(resolve => setTimeout(resolve, 10));
assert_equals(internals.audioSessionCategory(), "PlayAndRecord");
stream.removeTrack(stream.getAudioTracks()[0]);
await new Promise(resolve => setTimeout(resolve, 10));
assert_equals(internals.audioSessionCategory(), "PlayAndRecord");
}, "Check audio session state in case of disabled audio tracks");
</script>
</body>