From 7c25f37ebc8f010915fd710bb5347df1ae178289 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 23 Feb 2025 06:12:19 +1300 Subject: [PATCH] Removed Silence skipper --- README.md | 1 - materialious/android/app/build.gradle | 4 +- .../electron/materialious.metainfo.xml | 6 +- materialious/electron/package.json | 2 +- materialious/package.json | 2 +- materialious/src/lib/components/Player.svelte | 111 ------------------ .../src/lib/components/Settings/Player.svelte | 19 +-- materialious/src/lib/externalSettings.ts | 6 - materialious/src/lib/store.ts | 1 - update_versions.py | 2 +- 10 files changed, 11 insertions(+), 143 deletions(-) diff --git a/README.md b/README.md index 208864a1..086453bf 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ - [Invidious API extended integration!](https://github.com/Materialious/api-extended) - Sync your watch progress between Invidious sessions. - Watch sync parties! -- Silence skipper (Experimental.) - [YouTube.js](https://github.com/LuanRT/YouTube.js) fallback if Invidious fails loading videos for Desktop & Android. - Preview video on hover. - Sponsorblock built-in. diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index de19fc95..09618bb6 100644 --- a/materialious/android/app/build.gradle +++ b/materialious/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "us.materialio.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 96 - versionName "1.7.14" + versionCode 97 + versionName "1.7.15" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/materialious/electron/materialious.metainfo.xml b/materialious/electron/materialious.metainfo.xml index ddd969d8..62b73328 100644 --- a/materialious/electron/materialious.metainfo.xml +++ b/materialious/electron/materialious.metainfo.xml @@ -57,7 +57,11 @@ - + + + https://github.com/Materialious/Materialious/releases/tag/1.7.15 + + https://github.com/Materialious/Materialious/releases/tag/1.7.14 diff --git a/materialious/electron/package.json b/materialious/electron/package.json index 413ced29..50d53e8b 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.7.14", + "version": "1.7.15", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package.json b/materialious/package.json index bef5bdbd..757a6fe3 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.7.14", + "version": "1.7.15", "private": true, "scripts": { "dev": "vite dev", diff --git a/materialious/src/lib/components/Player.svelte b/materialious/src/lib/components/Player.svelte index 05337a58..63e31936 100644 --- a/materialious/src/lib/components/Player.svelte +++ b/materialious/src/lib/components/Player.svelte @@ -29,7 +29,6 @@ playerDefaultLanguage, playerProxyVideosStore, playerSavePlaybackPositionStore, - silenceSkipperStore, sponsorBlockCategoriesStore, sponsorBlockDisplayToastStore, sponsorBlockStore, @@ -62,16 +61,8 @@ let snackBarAlert = $state(''); let playerIsLive = $state(false); let playerPosSet = false; - - let userVideoSpeed = 1; - let silenceIsFastForwarding = false; - - let silenceSkipperInterval: NodeJS.Timeout; - let originalOrigination: ScreenOrientationResult | undefined; - let sponsorBlockElements: Element[] = []; - let watchProgressTimeout: NodeJS.Timeout; function setSponsorTimeline() { @@ -130,74 +121,8 @@ page.subscribe((pageUpdate) => loadTimeFromUrl(pageUpdate)); - let initStoreSilence = true; - silenceSkipperStore.subscribe((value) => { - if (initStoreSilence) { - initStoreSilence = false; - return; - } - - if (typeof silenceSkipperInterval !== 'undefined') { - clearInterval(silenceSkipperInterval); - } - - if (value) { - initSilenceSkipper(); - } - }); - const proxyVideos = get(playerProxyVideosStore); - function fastForwardToSound( - videoElement: HTMLAudioElement, - threshold: number = 0.01, - checkInterval: number = 100, - fastForwardRate: number = 4 - ): void { - if (!(videoElement instanceof HTMLMediaElement)) { - console.error('Provided element is not a valid HTMLMediaElement'); - return; - } - - const audioContext = new AudioContext(); - const source = audioContext.createMediaElementSource(videoElement); - const analyser = audioContext.createAnalyser(); - - source.connect(analyser); - analyser.connect(audioContext.destination); - analyser.fftSize = 256; - - const dataArray = new Uint8Array(analyser.frequencyBinCount); - - const checkForSound = () => { - analyser.getByteFrequencyData(dataArray); - - const averageVolume = dataArray.reduce((a, b) => a + b, 0) / dataArray.length; - const volume = averageVolume / 255; - - if (volume < threshold) { - if (!silenceIsFastForwarding) { - videoElement.playbackRate = fastForwardRate; - silenceIsFastForwarding = true; - } - } else { - if (silenceIsFastForwarding) { - videoElement.playbackRate = userVideoSpeed; - silenceIsFastForwarding = false; - } - } - }; - - silenceSkipperInterval = setInterval(checkForSound, checkInterval); - } - - function initSilenceSkipper() { - const videoContainer = document.getElementById('video') as HTMLElement; - const videoElement = videoContainer.querySelector('video') as HTMLMediaElement; - - fastForwardToSound(videoElement); - } - onMount(async () => { if (!data.video.hlsUrl) { playerIsLive = false; @@ -244,39 +169,6 @@ // Auto save watch progress every minute. watchProgressTimeout = setInterval(() => savePlayerPos(), 60000); - player.addEventListener('pause', () => { - savePlayerPos(); - if (get(silenceSkipperStore)) { - clearInterval(silenceSkipperInterval); - } - }); - - player.addEventListener('end', () => { - savePlayerPos(); - if (get(silenceSkipperStore)) { - clearInterval(silenceSkipperInterval); - } - }); - - player.addEventListener('play', () => { - if (get(silenceSkipperStore)) { - initSilenceSkipper(); - } - }); - - player.addEventListener('seeked', () => { - if (get(silenceSkipperStore)) { - clearInterval(silenceSkipperInterval); - - initSilenceSkipper(); - } - }); - - player.addEventListener('rate-change', () => { - if (silenceIsFastForwarding) return; - userVideoSpeed = player.playbackRate; - }); - player.addEventListener('provider-change', (event) => { const provider = event.detail as any; if (provider?.type === 'dash') { @@ -582,9 +474,6 @@ }); } } - if (typeof silenceSkipperInterval !== 'undefined') { - clearInterval(silenceSkipperInterval); - } if (watchProgressTimeout) { clearTimeout(watchProgressTimeout); } diff --git a/materialious/src/lib/components/Settings/Player.svelte b/materialious/src/lib/components/Settings/Player.svelte index a1988969..2a30dcd8 100644 --- a/materialious/src/lib/components/Settings/Player.svelte +++ b/materialious/src/lib/components/Settings/Player.svelte @@ -16,8 +16,7 @@ playerSavePlaybackPositionStore, playerTheatreModeByDefaultStore, playerYouTubeJsAlways, - playerYouTubeJsFallback, - silenceSkipperStore + playerYouTubeJsFallback } from '../../store'; let defaultLanguage = $state(get(playerDefaultLanguage)); @@ -192,22 +191,6 @@ -
- -
- {#if Capacitor.isNativePlatform()}