feat: video deband [no worky]

This commit is contained in:
ThaUnknown 2023-12-21 14:32:44 +01:00
parent 0a282027a6
commit 88e7b56c86
9 changed files with 68 additions and 23 deletions

View file

@ -6,7 +6,13 @@
},
"checkJs": true,
"target": "ESNext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"module": "ESNext",
"types": ["./types.d.ts"],
"allowSyntheticDefaultImports": true

View file

@ -147,6 +147,7 @@ export const defaults = {
playerAutoplay: true,
playerPause: true,
playerAutocomplete: true,
playerDeband: false,
rssQuality: '1080',
rssFeedsNew: [['New Releases', 'SubsPlease']],
rssAutoplay: true,

View file

@ -20,6 +20,7 @@
"svelte-loader": "^3.1.9",
"svelte-miniplayer": "^1.0.5",
"svelte-sonner": "^0.3.6",
"video-deband": "^1.0.5",
"webpack-merge": "^5.10.0"
}
}

View file

@ -1,15 +0,0 @@
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./*"],
},
"checkJs": true,
"target": "ESNext",
"moduleResolution": "node",
"module": "ESNext",
"types": ["./types.d.ts"],
"allowSyntheticDefaultImports": true
},
"exclude": ["node_modules", "dist", "build", "git_modules", "**/node_modules", "**/dist", "**/build", "**/git_modules",]
}

6
common/types.d.ts vendored
View file

@ -1,3 +1,5 @@
import type { SvelteComponentTyped } from 'svelte'
export {}
type Track = {
@ -31,3 +33,7 @@ declare global {
audioTracks: Track[]
}
}
declare module '*.svelte' {
export default SvelteComponentTyped
}

View file

@ -10,6 +10,7 @@
import { getChaptersAniSkip } from '@/modules/anime.js'
import Seekbar from 'perfect-seekbar'
import { click } from '@/modules/click.js'
import VideoDeband from 'video-deband'
import { w2gEmitter, state } from '../WatchTogether/WatchTogether.svelte'
import Keybinds, { loadWithDefaults, condition } from 'svelte-keybinds'
@ -132,6 +133,10 @@
function clearLoadInterval () {
clearInterval(loadInterval)
}
/**
* @type {VideoDeband}
*/
let deband
async function handleCurrent (file) {
if (file) {
@ -147,11 +152,20 @@
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()
}
}
@ -1080,6 +1094,18 @@
</div>
<style>
:global(.deband-canvas) {
max-width: 100%;
max-height: 100%;
width: 100% !important;
height: 100% !important;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
pointer-events: none;
object-fit: contain;
}
.fitWidth {
object-fit: cover;
}

View file

@ -125,3 +125,9 @@
<label for='player-autocomplete'>{settings.playerAutocomplete ? 'On' : 'Off'}</label>
</div>
</SettingCard>
<SettingCard title='EXPERIMENTAL: Video Deband' description='Applies the next playing video. This however will likely lead to colors being rendered incorrectly. Not recomended.'>
<div class='custom-switch'>
<input type='checkbox' id='player-deband' bind:checked={settings.playerDeband} />
<label for='player-deband'>{settings.playerDeband ? 'On' : 'Off'}</label>
</div>
</SettingCard>

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.5.6",
"version": "4.5.7",
"private": true,
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",

View file

@ -135,7 +135,7 @@ importers:
dependencies:
'@fontsource-variable/material-symbols-outlined':
specifier: latest
version: 5.0.17
version: 5.0.19
'@fontsource-variable/nunito':
specifier: latest
version: 5.0.17
@ -153,7 +153,7 @@ importers:
version: 1.0.1
jassub:
specifier: latest
version: 1.7.14
version: 1.7.15
js-levenshtein:
specifier: ^1.1.6
version: 1.1.6
@ -187,6 +187,9 @@ importers:
svelte-sonner:
specifier: ^0.3.6
version: 0.3.6(svelte@4.2.7)
video-deband:
specifier: ^1.0.5
version: 1.0.5
webpack-merge:
specifier: ^5.10.0
version: 5.10.0
@ -752,8 +755,8 @@ packages:
resolution: {integrity: sha512-XqGrDFJ15dNHeD4tT4imnTqrPhNb5C49hXwlfGcvcfV64BxFX0S4mq41q/34kxlObnShqKIqHwvxd9SPtG3H/g==}
dev: false
/@fontsource-variable/material-symbols-outlined@5.0.17:
resolution: {integrity: sha512-K0/pwNGhM+L5/kgRQGBUv+uHJK7f/Vs087PpuwszuU0HQ8QyECQjnwseHt7SUjjYgJC06nLNcm0+EmebO/jHUA==}
/@fontsource-variable/material-symbols-outlined@5.0.19:
resolution: {integrity: sha512-ZnVtmU4Z6hiKGPN8FDul5A3Fqaj5sdfajjHv4ScFkkiha3mNsdlTStl6dwD524LGjRW9zsdCxwmPIBasF7q88A==}
dev: false
/@fontsource-variable/nunito@5.0.16:
@ -5484,8 +5487,8 @@ packages:
minimatch: 3.1.2
dev: true
/jassub@1.7.14:
resolution: {integrity: sha512-sybiXH8wTlRxk3vTZpyYLX66SPwwBdAT3Y2hFvjs/GWhggap89VUID/H/xJX2LYwHpCyLCvZE34xitNuexW9ZQ==}
/jassub@1.7.15:
resolution: {integrity: sha512-8yKAJc++Y1gNfATOPRo3APk0JUhshKl5l7bRkT6WkJ8XP4RvYfVPb6ieH6WDxsMq523exwGzNvjjPEEWT+Z1nQ==}
dependencies:
rvfc-polyfill: 1.0.7
dev: false
@ -8267,6 +8270,10 @@ packages:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
dev: false
/three@0.159.0:
resolution: {integrity: sha512-eCmhlLGbBgucuo4VEA9IO3Qpc7dh8Bd4VKzr7WfW4+8hMcIfoAVi1ev0pJYN9PTTsCslbcKgBwr2wNZ1EvLInA==}
dev: false
/through2@2.0.5:
resolution: {integrity: sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==}
dependencies:
@ -8727,6 +8734,13 @@ packages:
dev: true
optional: true
/video-deband@1.0.5:
resolution: {integrity: sha512-ab4FI3ENsgKI+ho8f/Z760isqw3ghKCEMzehZPRs0uQb2o6fHAaGGLQN9oCQZhqfR136C8OJoEplKQ87X1GLtg==}
dependencies:
rvfc-polyfill: 1.0.7
three: 0.159.0
dev: false
/vite@5.0.4:
resolution: {integrity: sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==}
engines: {node: ^18.0.0 || >=20.0.0}