| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../video-test.js"></script> |
| <script src="../media-file.js"></script> |
| <script type="text/javascript"> |
| var session; |
| |
| function runTest() |
| { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| window.jsTestIsAsync = true; |
| |
| session = new MediaSession("content"); |
| |
| consoleWrite("Waiting for Content media to begin playing.") |
| var video = document.getElementById("video"); |
| waitForEvent('canplaythrough', beginPlaying); |
| video.src = findMediaFile("video", "../content/counting"); |
| video.session = session; |
| video.volume = 1; |
| video.onplaying = beganPlaying; |
| } |
| |
| function beginPlaying(event) |
| { |
| document.getElementById("video").play(); |
| } |
| |
| function beganPlaying(event) |
| { |
| consoleWrite("Media began playing."); |
| |
| if (window.internals) { |
| testExpected('internals.mediaSessionCurrentState(session)', "active"); |
| testExpected('internals.mediaElementPlayerVolume(document.getElementById("video"))', 1); |
| |
| consoleWrite("Sending 'Transient' start-of-interruption notification."); |
| run('internals.sendMediaSessionStartOfInterruptionNotification("transient")'); |
| |
| testExpected('internals.mediaSessionCurrentState(session)', "interrupted"); |
| testExpected('internals.mediaElementPlayerVolume(document.getElementById("video"))', 0.25); |
| |
| consoleWrite("Sending 'Transient' end-of-interruption notification."); |
| run('internals.sendMediaSessionEndOfInterruptionNotification("transient")'); |
| |
| testExpected('internals.mediaSessionCurrentState(session)', "active"); |
| testExpected('internals.mediaElementPlayerVolume(document.getElementById("video"))', 1); |
| } |
| |
| endTest(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>'Transient' interruption events should duck audio for 'Content' media sessions.</p> |
| <video id="video" /> |
| </body> |
| </html> |