Skip to content

Commit

Permalink
feat: video deband [no worky]
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Dec 21, 2023
1 parent 0a28202 commit 88e7b56
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 23 deletions.
8 changes: 7 additions & 1 deletion common/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions common/modules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const defaults = {
playerAutoplay: true,
playerPause: true,
playerAutocomplete: true,
playerDeband: false,
rssQuality: '1080',
rssFeedsNew: [['New Releases', 'SubsPlease']],
rssAutoplay: true,
Expand Down
1 change: 1 addition & 0 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
15 changes: 0 additions & 15 deletions common/tsconfig.json

This file was deleted.

6 changes: 6 additions & 0 deletions common/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { SvelteComponentTyped } from 'svelte'

export {}

type Track = {
Expand Down Expand Up @@ -31,3 +33,7 @@ declare global {
audioTracks: Track[]
}
}

declare module '*.svelte' {
export default SvelteComponentTyped
}
26 changes: 26 additions & 0 deletions common/views/Player/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -132,6 +133,10 @@
function clearLoadInterval () {
clearInterval(loadInterval)
}
/**
* @type {VideoDeband}
*/
let deband
async function handleCurrent (file) {
if (file) {
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions common/views/Settings/PlayerSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "4.5.6",
"version": "4.5.7",
"private": true,
"author": "ThaUnknown_ <[email protected]>",
"description": "Stream anime torrents, real-time with no waiting for downloads.",
Expand Down
26 changes: 20 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 88e7b56

Please sign in to comment.