aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-09-30 15:18:03 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-09-30 15:18:03 +0200
commit0f40d69a0f8c24969fd0afa8511ff598c604ca38 (patch)
tree05a77389e4e0f4bd0b4debe3c9af7f69c5edb6be /client/src/assets/player
parent8b183196cbafaa491bf70e32c82fabd2064ad462 (diff)
downloadPeerTube-0f40d69a0f8c24969fd0afa8511ff598c604ca38.tar.gz
PeerTube-0f40d69a0f8c24969fd0afa8511ff598c604ca38.tar.zst
PeerTube-0f40d69a0f8c24969fd0afa8511ff598c604ca38.zip
adding shortcuts to videojs, adding frame-by-frame support
Diffstat (limited to 'client/src/assets/player')
-rw-r--r--client/src/assets/player/peertube-player.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/client/src/assets/player/peertube-player.ts b/client/src/assets/player/peertube-player.ts
index 2c16c87ec..1bf6c9267 100644
--- a/client/src/assets/player/peertube-player.ts
+++ b/client/src/assets/player/peertube-player.ts
@@ -70,6 +70,25 @@ function getVideojsOptions (options: {
70 hotkeys: { 70 hotkeys: {
71 enableVolumeScroll: false, 71 enableVolumeScroll: false,
72 enableModifiersForNumbers: false, 72 enableModifiersForNumbers: false,
73
74 fullscreenKey: function (event) {
75 // fullscreen with the f key or Ctrl+Enter
76 return event.key === 'f' || (event.ctrlKey && event.key === 'Enter')
77 },
78
79 seekStep: function (event) {
80 // mimic VLC seek behavior, and default to 5 (original value is 5).
81 if (event.ctrlKey && event.altKey) {
82 return 5 * 60
83 } else if (event.ctrlKey) {
84 return 60
85 } else if (event.altKey) {
86 return 10
87 } else {
88 return 5
89 }
90 },
91
73 customKeys: { 92 customKeys: {
74 increasePlaybackRateKey: { 93 increasePlaybackRateKey: {
75 key: function (event) { 94 key: function (event) {
@@ -86,6 +105,17 @@ function getVideojsOptions (options: {
86 handler: function (player) { 105 handler: function (player) {
87 player.playbackRate((player.playbackRate() - 0.1).toFixed(2)) 106 player.playbackRate((player.playbackRate() - 0.1).toFixed(2))
88 } 107 }
108 },
109 frameByFrame: {
110 key: function (event) {
111 return event.key === '.'
112 },
113 handler: function (player, options, event) {
114 player.pause()
115 // Calculate movement distance (assuming 30 fps)
116 const dist = 1 / 30
117 player.currentTime(player.currentTime() + dist)
118 }
89 } 119 }
90 } 120 }
91 } 121 }