Skip to content

Commit

Permalink
feat: seek duration
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Aug 20, 2024
1 parent 3eb349c commit 246e713
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion common/modules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ export const defaults = {
extensions: SUPPORTS.extensions ? ['@thaunknown/ani-resourced'] : [],
sources: {},
enableExternal: false,
playerPath: ''
playerPath: '',
playerSeek: 2
}

export const subtitleExtensions = ['srt', 'vtt', 'ass', 'ssa', 'sub', 'txt']
Expand Down
14 changes: 8 additions & 6 deletions common/views/Player/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@
video.currentTime = targetTime
}
function forward () {
seek(2)
seek(settings.value.playerSeek)
}
function rewind () {
seek(-2)
seek(-settings.value.playerSeek)
}
function selectAudio (id) {
if (id !== undefined) {
Expand Down Expand Up @@ -553,17 +553,19 @@
e.preventDefault()
rewind()
},
id: '-2',
desc: 'Rewind 2s'
id: 'fast_rewind',
type: 'icon',
desc: 'Rewind'
},
ArrowRight: {
fn: e => {
e.stopImmediatePropagation()
e.preventDefault()
forward()
},
id: '+2',
desc: 'Seek 2s'
id: 'fast_forward',
type: 'icon',
desc: 'Seek'
},
ArrowUp: {
fn: e => {
Expand Down
8 changes: 8 additions & 0 deletions common/views/Settings/PlayerSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@
<label for='player-deband'>{settings.playerDeband ? 'On' : 'Off'}</label>
</div>
</SettingCard>
<SettingCard title='Seek Duration' description='Seconds to skip forward or backward when using the seek buttons or keyboard shortcuts. Higher values might negatively impact buffering speeds.'>
<div class='input-group w-100 mw-full'>
<input type='number' inputmode='numeric' pattern={'[0-9]*'} 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'>sec</span>
</div>
</div>
</SettingCard>

{#if SUPPORTS.externalPlayer}
<h4 class='mb-10 font-weight-bold'>External Player Settings</h4>
Expand Down

0 comments on commit 246e713

Please sign in to comment.