Add more keyboard shortcuts for the player (#7487)
* add keyboard shortcuts * fix lint * Update static/locales/en-US.yaml Co-authored-by: absidue <48293849+absidue@users.noreply.github.com> --------- Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
This commit is contained in:
parent
2c533a4347
commit
2a394328c7
@ -187,12 +187,16 @@ const KeyboardShortcuts = {
|
|||||||
SMALL_REWIND: 'arrowleft',
|
SMALL_REWIND: 'arrowleft',
|
||||||
SMALL_FAST_FORWARD: 'arrowright',
|
SMALL_FAST_FORWARD: 'arrowright',
|
||||||
DECREASE_VIDEO_SPEED: 'o',
|
DECREASE_VIDEO_SPEED: 'o',
|
||||||
|
DECREASE_VIDEO_SPEED_ALT: '<',
|
||||||
INCREASE_VIDEO_SPEED: 'p',
|
INCREASE_VIDEO_SPEED: 'p',
|
||||||
|
INCREASE_VIDEO_SPEED_ALT: '>',
|
||||||
SKIP_N_TENTHS: '0..9',
|
SKIP_N_TENTHS: '0..9',
|
||||||
LAST_CHAPTER: 'ctrl+arrowleft',
|
LAST_CHAPTER: 'ctrl+arrowleft',
|
||||||
NEXT_CHAPTER: 'ctrl+arrowright',
|
NEXT_CHAPTER: 'ctrl+arrowright',
|
||||||
LAST_FRAME: ',',
|
LAST_FRAME: ',',
|
||||||
NEXT_FRAME: '.',
|
NEXT_FRAME: '.',
|
||||||
|
HOME: 'home',
|
||||||
|
END: 'end',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -152,8 +152,10 @@ const localizedShortcutNameToShortcutsMappings = computed(() => {
|
|||||||
[t('KeyboardShortcutPrompt.Large Fast Forward'), ['LARGE_FAST_FORWARD']],
|
[t('KeyboardShortcutPrompt.Large Fast Forward'), ['LARGE_FAST_FORWARD']],
|
||||||
[t('KeyboardShortcutPrompt.Small Rewind'), ['SMALL_REWIND']],
|
[t('KeyboardShortcutPrompt.Small Rewind'), ['SMALL_REWIND']],
|
||||||
[t('KeyboardShortcutPrompt.Small Fast Forward'), ['SMALL_FAST_FORWARD']],
|
[t('KeyboardShortcutPrompt.Small Fast Forward'), ['SMALL_FAST_FORWARD']],
|
||||||
[t('KeyboardShortcutPrompt.Decrease Video Speed'), ['DECREASE_VIDEO_SPEED']],
|
[t('KeyboardShortcutPrompt.Decrease Video Speed'), ['DECREASE_VIDEO_SPEED', 'DECREASE_VIDEO_SPEED_ALT']],
|
||||||
[t('KeyboardShortcutPrompt.Increase Video Speed'), ['INCREASE_VIDEO_SPEED']],
|
[t('KeyboardShortcutPrompt.Increase Video Speed'), ['INCREASE_VIDEO_SPEED', 'INCREASE_VIDEO_SPEED_ALT']],
|
||||||
|
[t('KeyboardShortcutPrompt.Home'), ['HOME']],
|
||||||
|
[t('KeyboardShortcutPrompt.End'), ['END']],
|
||||||
[t('KeyboardShortcutPrompt.Skip by Tenths'), ['SKIP_N_TENTHS']],
|
[t('KeyboardShortcutPrompt.Skip by Tenths'), ['SKIP_N_TENTHS']],
|
||||||
[t('KeyboardShortcutPrompt.Last Chapter'), ['LAST_CHAPTER']],
|
[t('KeyboardShortcutPrompt.Last Chapter'), ['LAST_CHAPTER']],
|
||||||
[t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']],
|
[t('KeyboardShortcutPrompt.Next Chapter'), ['NEXT_CHAPTER']],
|
||||||
|
@ -2116,11 +2116,13 @@ export default defineComponent({
|
|||||||
seekBySeconds(defaultSkipInterval.value * player.getPlaybackRate() * 2)
|
seekBySeconds(defaultSkipInterval.value * player.getPlaybackRate() * 2)
|
||||||
break
|
break
|
||||||
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.DECREASE_VIDEO_SPEED:
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.DECREASE_VIDEO_SPEED:
|
||||||
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.DECREASE_VIDEO_SPEED_ALT:
|
||||||
// Decrease playback rate by user configured interval
|
// Decrease playback rate by user configured interval
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
changePlayBackRate(-videoPlaybackRateInterval.value)
|
changePlayBackRate(-videoPlaybackRateInterval.value)
|
||||||
break
|
break
|
||||||
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.INCREASE_VIDEO_SPEED:
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.INCREASE_VIDEO_SPEED:
|
||||||
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.INCREASE_VIDEO_SPEED_ALT:
|
||||||
// Increase playback rate by user configured interval
|
// Increase playback rate by user configured interval
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
changePlayBackRate(videoPlaybackRateInterval.value)
|
changePlayBackRate(videoPlaybackRateInterval.value)
|
||||||
@ -2235,6 +2237,24 @@ export default defineComponent({
|
|||||||
detail: !showStats.value
|
detail: !showStats.value
|
||||||
}))
|
}))
|
||||||
break
|
break
|
||||||
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.HOME:
|
||||||
|
// Jump to beginning of video
|
||||||
|
if (canSeek()) {
|
||||||
|
event.preventDefault()
|
||||||
|
// use seek range instead of duration so that it works for live streams too
|
||||||
|
const seekRange = player.seekRange()
|
||||||
|
video_.currentTime = seekRange.start
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.END:
|
||||||
|
// Jump to end of video
|
||||||
|
if (canSeek()) {
|
||||||
|
event.preventDefault()
|
||||||
|
// use seek range instead of duration so that it works for live streams too
|
||||||
|
const seekRange = player.seekRange()
|
||||||
|
video_.currentTime = seekRange.end
|
||||||
|
}
|
||||||
|
break
|
||||||
case 'escape':
|
case 'escape':
|
||||||
// Exit full window
|
// Exit full window
|
||||||
if (fullWindowEnabled.value) {
|
if (fullWindowEnabled.value) {
|
||||||
|
@ -1214,3 +1214,5 @@ KeyboardShortcutPrompt:
|
|||||||
Last Chapter: Last Chapter
|
Last Chapter: Last Chapter
|
||||||
Next Chapter: Next Chapter
|
Next Chapter: Next Chapter
|
||||||
Skip by Tenths: Skip through video by percentage (3 skips to 30% of duration)
|
Skip by Tenths: Skip through video by percentage (3 skips to 30% of duration)
|
||||||
|
Home: Seek to the beginning of the video
|
||||||
|
End: Seek to the end of the video
|
||||||
|
Loading…
x
Reference in New Issue
Block a user