feat: custom seek duration

This commit is contained in:
ghostmander 2023-12-13 20:41:03 +05:30 committed by NoCrypt
parent da73f82b95
commit aa3fcdf52c
3 changed files with 21 additions and 8 deletions

View file

@ -126,6 +126,7 @@ export const defaults = {
playerPause: true,
playerAutocomplete: true,
playerDeband: false,
playerSeek: 2,
rssQuality: '1080',
rssFeedsNew: SUPPORTS.extensions ? [['New Releases', 'ASW [Small Size]']] : [],
rssAutoplay: false,

View file

@ -351,10 +351,10 @@
video.currentTime = targetTime
}
function forward () {
seek(2)
seek($settings.playerSeek)
}
function rewind () {
seek(-2)
seek(-$settings.playerSeek)
}
function selectAudio (id) {
if (id !== undefined) {
@ -465,7 +465,7 @@
}
let fitWidth = false
let showKeybinds = false
loadWithDefaults({
const ld = () => loadWithDefaults({
KeyX: {
fn: () => screenshot(),
id: 'screenshot_monitor',
@ -479,7 +479,10 @@
desc: 'Toggle Stats'
},
Backquote: {
fn: () => (showKeybinds = !showKeybinds),
fn: () => {
ld();
(showKeybinds = !showKeybinds);
},
id: 'help_outline',
type: 'icon',
desc: 'Toggle Keybinds'
@ -557,8 +560,8 @@
e.preventDefault()
rewind()
},
id: '-2',
desc: 'Rewind 2s'
id: `-${$settings.playerSeek}`,
desc: `Rewind ${$settings.playerSeek}s`
},
ArrowRight: {
fn: e => {
@ -566,8 +569,8 @@
e.preventDefault()
forward()
},
id: '+2',
desc: 'Seek 2s'
id: `+${$settings.playerSeek}`,
desc: `Seek ${$settings.playerSeek}s`
},
ArrowUp: {
fn: e => {
@ -630,6 +633,7 @@
container.append(canvas)
return { stream: canvas.captureStream(), destroy }
}
ld()
// function initCast (event) {
// // these quality settings are likely to make cast overheat, oh noes!

View file

@ -142,6 +142,14 @@
<label for='player-autocomplete'>{settings.playerAutocomplete ? 'On' : 'Off'}</label>
</div>
</SettingCard>
<SettingCard title='Seek Duration' description='Seconds to seek an episode with arrow keys'>
<div class='input-group w-100 mw-full'>
<input type='number' bind:value={settings.playerSeek} min='1' max='50' class='form-control text-right bg-dark' />
<div class='input-group-append'>
<span class='input-group-text bg-dark'>s</span>
</div>
</div>
</SettingCard>
<SettingCard title='Deband Video' description='Reduces banding on dark and compressed videos. High performance impact, not recommended for high quality videos.'>
<div class='custom-switch'>
<input type='checkbox' id='player-deband' bind:checked={settings.playerDeband} />