aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-12-28 11:36:04 -0500
committerGitHub <[email protected]>2021-12-28 11:36:04 -0500
commita1bae95cdcbff623692fb1e67695818ec3a54b7b (patch)
tree463619bf380303400971b8a9e07334879b90d1d9
parentc5b72a01a2da17e69753d81c212faccdffbef147 (diff)
parent3d3b261f8f759852d8ea0bf34d4dc5a6127928d7 (diff)
downloadSponsorBlock-a1bae95cdcbff623692fb1e67695818ec3a54b7b.tar.gz
SponsorBlock-a1bae95cdcbff623692fb1e67695818ec3a54b7b.zip
Merge pull request #1091 from AronHK/audio-notification
Decouple audio notification from Skip Notice
-rw-r--r--src/components/SkipNoticeComponent.tsx13
-rw-r--r--src/content.ts7
2 files changed, 6 insertions, 14 deletions
diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx
index 925660ec..002218b6 100644
--- a/src/components/SkipNoticeComponent.tsx
+++ b/src/components/SkipNoticeComponent.tsx
@@ -74,7 +74,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
amountOfPreviousNotices: number;
showInSecondSlot: boolean;
- audio: HTMLAudioElement;
idSuffix: string;
@@ -96,7 +95,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
this.segments = props.segments;
this.autoSkip = props.autoSkip;
this.contentContainer = props.contentContainer;
- this.audio = null;
const noticeTitle = getSkippingText(this.segments, this.props.autoSkip);
@@ -156,13 +154,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
}
}
- componentDidMount(): void {
- if (Config.config.audioNotificationOnSkip && this.audio) {
- this.audio.volume = this.contentContainer().v.volume * 0.1;
- if (this.autoSkip) this.audio.play();
- }
- }
-
render(): React.ReactElement {
const noticeStyle: React.CSSProperties = { }
if (this.contentContainer().onMobileYouTube) {
@@ -196,10 +187,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
firstColumn={firstColumn}
bottomRow={[...this.getMessageBoxes(), ...this.getBottomRow() ]}
onMouseEnter={() => this.onMouseEnter() } >
-
- {(Config.config.audioNotificationOnSkip) && <audio ref={(source) => { this.audio = source; }}>
- <source src={chrome.extension.getURL("icons/beep.ogg")} type="audio/ogg"></source>
- </audio>}
</NoticeComponent>
);
}
diff --git a/src/content.ts b/src/content.ts
index 47f27f68..681ef10c 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -1222,7 +1222,12 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
break;
}
}
-
+ }
+
+ if (autoSkip && Config.config.audioNotificationOnSkip) {
+ const beep = new Audio(chrome.runtime.getURL("icons/beep.ogg"));
+ beep.volume = video.volume * 0.1;
+ beep.play();
}
if (!autoSkip