mirror of https://github.com/Chocobozzz/PeerTube
adding shortcuts to videojs, adding frame-by-frame support
parent
8b183196cb
commit
0f40d69a0f
|
@ -70,6 +70,25 @@ function getVideojsOptions (options: {
|
||||||
hotkeys: {
|
hotkeys: {
|
||||||
enableVolumeScroll: false,
|
enableVolumeScroll: false,
|
||||||
enableModifiersForNumbers: false,
|
enableModifiersForNumbers: false,
|
||||||
|
|
||||||
|
fullscreenKey: function (event) {
|
||||||
|
// fullscreen with the f key or Ctrl+Enter
|
||||||
|
return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
|
||||||
|
},
|
||||||
|
|
||||||
|
seekStep: function (event) {
|
||||||
|
// mimic VLC seek behavior, and default to 5 (original value is 5).
|
||||||
|
if (event.ctrlKey && event.altKey) {
|
||||||
|
return 5 * 60
|
||||||
|
} else if (event.ctrlKey) {
|
||||||
|
return 60
|
||||||
|
} else if (event.altKey) {
|
||||||
|
return 10
|
||||||
|
} else {
|
||||||
|
return 5
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
customKeys: {
|
customKeys: {
|
||||||
increasePlaybackRateKey: {
|
increasePlaybackRateKey: {
|
||||||
key: function (event) {
|
key: function (event) {
|
||||||
|
@ -86,6 +105,17 @@ function getVideojsOptions (options: {
|
||||||
handler: function (player) {
|
handler: function (player) {
|
||||||
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
|
player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
frameByFrame: {
|
||||||
|
key: function (event) {
|
||||||
|
return event.key === '.'
|
||||||
|
},
|
||||||
|
handler: function (player, options, event) {
|
||||||
|
player.pause()
|
||||||
|
// Calculate movement distance (assuming 30 fps)
|
||||||
|
const dist = 1 / 30
|
||||||
|
player.currentTime(player.currentTime() + dist)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue