diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-12 16:01:39 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-13 11:16:35 +0100 |
commit | fc3412fd4e90c8836dfd8ced6f85c6118adfbe75 (patch) | |
tree | c8d2e2daeae04233deb4607ab254b84f755992bc /client/src | |
parent | dd200d34773905300c871e3a779556755df293d9 (diff) | |
download | PeerTube-fc3412fd4e90c8836dfd8ced6f85c6118adfbe75.tar.gz PeerTube-fc3412fd4e90c8836dfd8ced6f85c6118adfbe75.tar.zst PeerTube-fc3412fd4e90c8836dfd8ced6f85c6118adfbe75.zip |
Cleanup player hotkeys
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 28 | ||||
-rw-r--r-- | client/src/assets/player/peertube-player-manager.ts | 15 |
2 files changed, 30 insertions, 13 deletions
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index d3d04d236..5fd095c36 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -714,22 +714,28 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
714 | private initHotkeys () { | 714 | private initHotkeys () { |
715 | this.hotkeys = [ | 715 | this.hotkeys = [ |
716 | // These hotkeys are managed by the player | 716 | // These hotkeys are managed by the player |
717 | new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen (requires player focus)`), | 717 | new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen`), |
718 | new Hotkey('space', e => e, undefined, $localize`Play/Pause the video (requires player focus)`), | 718 | new Hotkey('space', e => e, undefined, $localize`Play/Pause the video`), |
719 | new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video (requires player focus)`), | 719 | new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video`), |
720 | 720 | ||
721 | new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)`), | 721 | new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90%`), |
722 | 722 | ||
723 | new Hotkey('up', e => e, undefined, $localize`Increase the volume (requires player focus)`), | 723 | new Hotkey('up', e => e, undefined, $localize`Increase the volume`), |
724 | new Hotkey('down', e => e, undefined, $localize`Decrease the volume (requires player focus)`), | 724 | new Hotkey('down', e => e, undefined, $localize`Decrease the volume`), |
725 | 725 | ||
726 | new Hotkey('right', e => e, undefined, $localize`Seek the video forward (requires player focus)`), | 726 | new Hotkey('right', e => e, undefined, $localize`Seek the video forward`), |
727 | new Hotkey('left', e => e, undefined, $localize`Seek the video backward (requires player focus)`), | 727 | new Hotkey('left', e => e, undefined, $localize`Seek the video backward`), |
728 | 728 | ||
729 | new Hotkey('>', e => e, undefined, $localize`Increase playback rate (requires player focus)`), | 729 | new Hotkey('>', e => e, undefined, $localize`Increase playback rate`), |
730 | new Hotkey('<', e => e, undefined, $localize`Decrease playback rate (requires player focus)`), | 730 | new Hotkey('<', e => e, undefined, $localize`Decrease playback rate`), |
731 | 731 | ||
732 | new Hotkey('.', e => e, undefined, $localize`Navigate in the video frame by frame (requires player focus)`) | 732 | new Hotkey(',', e => e, undefined, $localize`Navigate in the video to the previous frame`), |
733 | new Hotkey('.', e => e, undefined, $localize`Navigate in the video to the next frame`), | ||
734 | |||
735 | new Hotkey('t', e => { | ||
736 | this.theaterEnabled = !this.theaterEnabled | ||
737 | return false | ||
738 | }, undefined, $localize`Toggle theater mode`) | ||
733 | ] | 739 | ] |
734 | 740 | ||
735 | if (this.isUserLoggedIn()) { | 741 | if (this.isUserLoggedIn()) { |
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index b5317f45b..d715adf56 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts | |||
@@ -687,9 +687,20 @@ export class PeertubePlayerManager { | |||
687 | player.playbackRate(parseFloat(newValue.toFixed(2))) | 687 | player.playbackRate(parseFloat(newValue.toFixed(2))) |
688 | } | 688 | } |
689 | }, | 689 | }, |
690 | frameByFrame: { | 690 | previousFrame: { |
691 | key: function (event: KeyboardEvent) { | 691 | key: function (event: KeyboardEvent) { |
692 | return isNaked(event, '.') | 692 | return event.key === ',' |
693 | }, | ||
694 | handler: function (player: videojs.Player) { | ||
695 | player.pause() | ||
696 | // Calculate movement distance (assuming 30 fps) | ||
697 | const dist = 1 / 30 | ||
698 | player.currentTime(player.currentTime() - dist) | ||
699 | } | ||
700 | }, | ||
701 | nextFrame: { | ||
702 | key: function (event: KeyboardEvent) { | ||
703 | return event.key === '.' | ||
693 | }, | 704 | }, |
694 | handler: function (player: videojs.Player) { | 705 | handler: function (player: videojs.Player) { |
695 | player.pause() | 706 | player.pause() |