add bindMediaKey to options

This commit is contained in:
Michael C
2022-01-27 01:43:40 -05:00
parent 6d0d533fa7
commit 876b55dcc1
4 changed files with 25 additions and 2 deletions

View File

@@ -36,7 +36,8 @@ interface SBConfig {
serverAddress: string,
minDuration: number,
skipNoticeDuration: number,
audioNotificationOnSkip,
audioNotificationOnSkip: boolean,
bindMediaKey: boolean,
checkForUnlistedVideos: boolean,
testingServer: boolean,
refetchWhenNotFound: boolean,
@@ -198,6 +199,7 @@ const Config: SBObject = {
minDuration: 0,
skipNoticeDuration: 4,
audioNotificationOnSkip: false,
bindMediaKey: false,
checkForUnlistedVideos: false,
testingServer: false,
refetchWhenNotFound: true,

View File

@@ -1273,7 +1273,8 @@ 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();
window.addEventListener("keydown", mediaPauseListener);
if (Config.config.audioNotificationOnSkip && Config.config.bindMediaKey)
window.addEventListener("keydown", mediaPauseListener);
}
if (!autoSkip