mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
force listen for mediaKeys
This commit is contained in:
parent
9457aff44f
commit
6d0d533fa7
3 changed files with 6 additions and 33676 deletions
33671
package-lock.json
generated
33671
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,6 @@
|
|||
"@types/firefox-webext-browser": "70.0.1",
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/jquery": "^3.3.31",
|
||||
"@types/wicg-mediasession": "^1.1.3",
|
||||
"@typescript-eslint/eslint-plugin": "^4.9.1",
|
||||
"@typescript-eslint/parser": "^4.9.1",
|
||||
"chromedriver": "^92.0.0",
|
||||
|
|
|
@ -1273,10 +1273,7 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
|||
const beep = new Audio(chrome.runtime.getURL("icons/beep.ogg"));
|
||||
beep.volume = video.volume * 0.1;
|
||||
beep.play();
|
||||
beep.controls = false;
|
||||
// hijack media function
|
||||
navigator.mediaSession.setActionHandler('play', () => video.play())
|
||||
navigator.mediaSession.setActionHandler("pause", () => video.pause())
|
||||
window.addEventListener("keydown", mediaPauseListener);
|
||||
}
|
||||
|
||||
if (!autoSkip
|
||||
|
@ -2041,4 +2038,9 @@ function checkForPreloadedSegment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function mediaPauseListener(e: KeyboardEvent) {
|
||||
if (e.key === "MediaPlayPause")
|
||||
video?.paused ? video.play() : video.pause();
|
||||
}
|
Loading…
Reference in a new issue