| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../video-test.js"></script> |
| <script src="../media-file.js"></script> |
| <script type="text/javascript"> |
| var session; |
| |
| function runTest() |
| { |
| run('session = new MediaSession("content")'); |
| |
| findMediaElement(); |
| waitForEvent('canplaythrough', beginPlaying); |
| video.src = findMediaFile("video", "../content/counting"); |
| video.session = session; |
| waitForEvent('playing', beganPlaying, false, true, video); |
| } |
| |
| function beginPlaying(event) |
| { |
| testExpected('video.paused', true); |
| |
| consoleWrite("Begin playing media."); |
| video.play(); |
| } |
| |
| function beganPlaying(event) |
| { |
| consoleWrite("Media began playing."); |
| testExpected('video.paused', false); |
| |
| run('video.session = new MediaSession("transient")'); |
| |
| testExpected('video.paused', true); |
| |
| endTest(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>When switching media sessions, media elements belonging to the old session should be paused.</p> |
| <video id="video" /> |
| </body> |
| </html> |