| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>interruption-sends-pause-action</title> |
| <script src="../video-test.js"></script> |
| <script> |
| window.addEventListener('load', event => { |
| runTest().then(endTest).catch(failTest); |
| }) |
| |
| var pauseActionPromise; |
| var playActionPromise; |
| |
| async function runTest() { |
| |
| pauseActionPromise = new Promise(resolve => { |
| navigator.mediaSession.setActionHandler('pause', action => { |
| resolve() |
| }); |
| }); |
| |
| playActionPromise = new Promise(resolve => { |
| navigator.mediaSession.setActionHandler('play', action => { |
| resolve() |
| }); |
| }); |
| |
| run('navigator.mediaSession.setPositionState({position: 0, duration: 100, plyabackRate: 1})'); |
| run('navigator.mediaSession.playbackState = "playing"'); |
| run('internals.beginMediaSessionInterruption("system")'); |
| await shouldResolve(pauseActionPromise); |
| |
| run('internals.endMediaSessionInterruption("mayresumeplaying")'); |
| await shouldResolve(playActionPromise); |
| } |
| </script> |
| </head> |