aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts38
1 files changed, 24 insertions, 14 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 fa0417832..84548de97 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -133,8 +133,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
133 this.loadRouteParams() 133 this.loadRouteParams()
134 this.loadRouteQuery() 134 this.loadRouteQuery()
135 135
136 this.initHotkeys()
137
138 this.theaterEnabled = getStoredTheater() 136 this.theaterEnabled = getStoredTheater()
139 137
140 this.hooks.runAction('action:video-watch.init', 'video-watch') 138 this.hooks.runAction('action:video-watch.init', 'video-watch')
@@ -407,6 +405,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
407 if (res === false) return this.location.back() 405 if (res === false) return this.location.back()
408 } 406 }
409 407
408 this.buildHotkeysHelp(video)
409
410 this.buildPlayer({ urlOptions, loggedInOrAnonymousUser, forceAutoplay }) 410 this.buildPlayer({ urlOptions, loggedInOrAnonymousUser, forceAutoplay })
411 .catch(err => logger.error('Cannot build the player', err)) 411 .catch(err => logger.error('Cannot build the player', err))
412 412
@@ -787,33 +787,43 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
787 this.video.viewers = newViewers 787 this.video.viewers = newViewers
788 } 788 }
789 789
790 private initHotkeys () { 790 private buildHotkeysHelp (video: Video) {
791 if (this.hotkeys.length !== 0) {
792 this.hotkeysService.remove(this.hotkeys)
793 }
794
791 this.hotkeys = [ 795 this.hotkeys = [
792 // These hotkeys are managed by the player 796 // These hotkeys are managed by the player
793 new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen`), 797 new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen`),
794 new Hotkey('space', e => e, undefined, $localize`Play/Pause the video`), 798 new Hotkey('space', e => e, undefined, $localize`Play/Pause the video`),
795 new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video`), 799 new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video`),
796 800
797 new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90%`),
798
799 new Hotkey('up', e => e, undefined, $localize`Increase the volume`), 801 new Hotkey('up', e => e, undefined, $localize`Increase the volume`),
800 new Hotkey('down', e => e, undefined, $localize`Decrease the volume`), 802 new Hotkey('down', e => e, undefined, $localize`Decrease the volume`),
801 803
802 new Hotkey('right', e => e, undefined, $localize`Seek the video forward`),
803 new Hotkey('left', e => e, undefined, $localize`Seek the video backward`),
804
805 new Hotkey('>', e => e, undefined, $localize`Increase playback rate`),
806 new Hotkey('<', e => e, undefined, $localize`Decrease playback rate`),
807
808 new Hotkey(',', e => e, undefined, $localize`Navigate in the video to the previous frame`),
809 new Hotkey('.', e => e, undefined, $localize`Navigate in the video to the next frame`),
810
811 new Hotkey('t', e => { 804 new Hotkey('t', e => {
812 this.theaterEnabled = !this.theaterEnabled 805 this.theaterEnabled = !this.theaterEnabled
813 return false 806 return false
814 }, undefined, $localize`Toggle theater mode`) 807 }, undefined, $localize`Toggle theater mode`)
815 ] 808 ]
816 809
810 if (!video.isLive) {
811 this.hotkeys = this.hotkeys.concat([
812 // These hotkeys are also managed by the player but only for VOD
813
814 new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90%`),
815
816 new Hotkey('right', e => e, undefined, $localize`Seek the video forward`),
817 new Hotkey('left', e => e, undefined, $localize`Seek the video backward`),
818
819 new Hotkey('>', e => e, undefined, $localize`Increase playback rate`),
820 new Hotkey('<', e => e, undefined, $localize`Decrease playback rate`),
821
822 new Hotkey(',', e => e, undefined, $localize`Navigate in the video to the previous frame`),
823 new Hotkey('.', e => e, undefined, $localize`Navigate in the video to the next frame`)
824 ])
825 }
826
817 if (this.isUserLoggedIn()) { 827 if (this.isUserLoggedIn()) {
818 this.hotkeys = this.hotkeys.concat([ 828 this.hotkeys = this.hotkeys.concat([
819 new Hotkey('shift+s', () => { 829 new Hotkey('shift+s', () => {