| <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> |