[iOS] Video occasionally mixes with other system audio instead of interrupting
[WebKit-https.git] / LayoutTests / platform / mac / media / audio-session-category-video-track-change.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>audio-session-category-track-change</title>
5     <script src="../../../media/video-test.js"></script>
6     <script src="../../../media/media-file.js"></script>
7     <script>
8     function go() {
9         findMediaElement();
10         run('internals.settings.setShouldManageAudioSessionCategory(true)');
11         run('video.src = findMediaFile("video", "../../../media/content/test")');
12         waitForEvent('canplay', canplay);
13     }
14
15     function canplay() {
16         testExpected('internals.audioSessionCategory()', 'None');
17         run('video.audioTracks[0].enabled = false');
18         waitForEventOnceOn(video.audioTracks, 'change', trackDisabled);
19     }
20
21     function trackDisabled() {
22         testExpected('internals.audioSessionCategory()', 'None');
23         run('video.muted = false');
24         waitForEvent('volumechange', volumechange);
25     }
26
27     function volumechange() {
28         testExpected('internals.audioSessionCategory()', 'None');
29         run('video.play()');
30         waitForEvent('playing', playing);
31     }
32
33     function playing() {
34         testExpected('internals.audioSessionCategory()', 'None');
35         run('video.audioTracks[0].enabled = true');
36         waitForEventOnceOn(video.audioTracks, 'change', trackEnabled);
37     }
38
39     function trackEnabled() {
40         testExpected('internals.audioSessionCategory()', 'MediaPlayback');
41         endTest();
42     }
43     </script>
44 </head>
45 <body onload="go()">
46     <video controls muted></video>
47 </body>
48 </html>