Skip to content

Instantly share code, notes, and snippets.

@gotbahn
Last active March 31, 2020 11:48
Show Gist options
  • Save gotbahn/7b7e57438db3ae650b14abc29f815318 to your computer and use it in GitHub Desktop.
Save gotbahn/7b7e57438db3ae650b14abc29f815318 to your computer and use it in GitHub Desktop.
Media Session. Play & pause action handlers
// 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