From 6ef13b00db4013bf785af623fd91f33300658ba6 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Thu, 21 Dec 2023 15:57:59 +0100 Subject: [PATCH] fix: deband support and descriptions fix: captions menu sizing and offset button --- common/views/Player/Player.svelte | 31 +++++++++++++-------- common/views/Settings/PlayerSettings.svelte | 2 +- electron/src/main/util.js | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/common/views/Player/Player.svelte b/common/views/Player/Player.svelte index 33ad65f..f2368f0 100644 --- a/common/views/Player/Player.svelte +++ b/common/views/Player/Player.svelte @@ -2,7 +2,7 @@ import { settings } from '@/modules/settings.js' import { playAnime } from '../RSSView.svelte' import { client } from '@/modules/torrent.js' - import { createEventDispatcher } from 'svelte' + import { createEventDispatcher, onMount } from 'svelte' import { alEntry } from '@/modules/anilist.js' import Subtitles from '@/modules/subtitles.js' import { toTS, fastPrettyBytes, videoRx } from '@/modules/util.js' @@ -138,6 +138,19 @@ */ let deband + function loadDeband (load, video) { + if (!video) return + if (load) { + deband = new VideoDeband(video) + deband.canvas.classList.add('deband-canvas') + video.before(deband.canvas) + } else if (deband) { + deband.destroy() + deband.canvas.remove() + } + } + $: loadDeband($settings.playerDeband, video) + async function handleCurrent (file) { if (file) { if (thumbnailData.video?.src) URL.revokeObjectURL(video?.src) @@ -152,20 +165,11 @@ currentSkippable = null completed = false if (subs) subs.destroy() - if (deband) { - deband.destroy() - deband.canvas.remove() - } current = file emit('current', current) src = file.url client.send('current', file) subs = new Subtitles(video, files, current, handleHeaders) - if ($settings.playerDeband) { - deband = new VideoDeband(video) - deband.canvas.classList.add('deband-canvas') - video.parentNode.append(deband.canvas) - } video.load() } } @@ -1061,7 +1065,7 @@ subtitles - {/if} @@ -1106,6 +1110,9 @@ pointer-events: none; object-fit: contain; } + :global(.deband-canvas) ~ video { + opacity: 0; + } .fitWidth { object-fit: cover; } diff --git a/common/views/Settings/PlayerSettings.svelte b/common/views/Settings/PlayerSettings.svelte index d0e2fe3..0514a89 100644 --- a/common/views/Settings/PlayerSettings.svelte +++ b/common/views/Settings/PlayerSettings.svelte @@ -125,7 +125,7 @@ - +
diff --git a/electron/src/main/util.js b/electron/src/main/util.js index 65d23f5..cc74a4c 100644 --- a/electron/src/main/util.js +++ b/electron/src/main/util.js @@ -17,7 +17,7 @@ const flags = [ ['disable-color-correct-rendering'], ['autoplay-policy', 'no-user-gesture-required'], ['disable-notifications'], ['disable-logging'], ['disable-permissions-api'], ['no-sandbox'], ['no-zygote'], ['bypasscsp-schemes'], - ['force-color-profile', 'srgb'] + ['force-color-profile', 'srgb'] // TODO: should this be "scrgb-linear"? ] for (const [flag, value] of flags) { app.commandLine.appendSwitch(flag, value)