Last active
March 31, 2020 11:48
-
-
Save gotbahn/290e816ea50962c245c924dd19d79580 to your computer and use it in GitHub Desktop.
Media Session. Play & pause action handlers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to set action handlers | |
window.navigator.mediasSession.setActionHandler('play', () => { /* your play */ }); | |
window.navigator.mediasSession.setActionHandler('pause', () => { /* your pause */ }); | |
// to reset action handlers | |
window.navigator.mediasSession.setActionHandler('play', null); | |
window.navigator.mediasSession.setActionHandler('pause', null); | |
// handlers like action & pause have defaults, to cancel them you can use noop function | |
window.navigator.mediasSession.setActionHandler('play', () => {}); | |
window.navigator.mediasSession.setActionHandler('pause', () => {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment