From a5de47aa6f1047d1a7e28d168703cf4ade798e28 Mon Sep 17 00:00:00 2001 From: Bennett Date: Thu, 1 Jul 2021 11:09:24 +0200 Subject: [PATCH] #52 Use 1.01 instead of 1 for playback speed to remove clicking --- src/pages/content/lib/SilenceSkipper.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/content/lib/SilenceSkipper.ts b/src/pages/content/lib/SilenceSkipper.ts index cf5d33a..fd6ff92 100644 --- a/src/pages/content/lib/SilenceSkipper.ts +++ b/src/pages/content/lib/SilenceSkipper.ts @@ -134,7 +134,15 @@ export default class SilenceSkipper { * Attempts to change the video playback rate */ _setPlaybackRate(rate: number) { - this._targetPlaybackRate = rate + this._targetPlaybackRate = rate; + + if (rate === 1) { + // Setting the speed to exactly 1 will cause audio clicking + // Setting the speed to slightly greater than 1 will prevent this from happening + // Related: https://github.com/vantezzen/skip-silence/issues/52 + this._targetPlaybackRate = 1.01; + } + this.element.playbackRate = this._targetPlaybackRate; if (!this._handlingRateChangeError) { // Make sure that the playback rate actually changed