Last active
March 31, 2020 11:48
-
-
Save gotbahn/7b7e57438db3ae650b14abc29f815318 to your computer and use it in GitHub Desktop.
Media Session. Play & pause action handlers
This file contains 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 add seek action handlers | |
if (/* can seek backward */) { | |
window.navigator.mediasSession.setActionHandler('seekbackward', () => { /* your seek backward */ }); | |
} | |
if (/* can seek forward */) { | |
window.navigator.mediasSession.setActionHandler('seekforward', () => { /* your seek forward */ }); | |
} | |
// to cancel seek action handlers | |
window.navigator.mediasSession.setActionHandler('seekbackward', null); | |
window.navigator.mediasSession.setActionHandler('seekforward', null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment