]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/videos/+video-watch/video-watch.component.ts
autoplay next video support for playlists
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-watch / video-watch.component.ts
1 import { catchError } from 'rxjs/operators'
2 import { ChangeDetectorRef, Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
3 import { ActivatedRoute, Router } from '@angular/router'
4 import { RedirectService } from '@app/core/routing/redirect.service'
5 import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
6 import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component'
7 import { MetaService } from '@ngx-meta/core'
8 import { AuthUser, Notifier, ServerService } from '@app/core'
9 import { forkJoin, Observable, Subscription } from 'rxjs'
10 import { Hotkey, HotkeysService } from 'angular2-hotkeys'
11 import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
12 import { AuthService, ConfirmService } from '../../core'
13 import { RestExtractor, VideoBlacklistService } from '../../shared'
14 import { VideoDetails } from '../../shared/video/video-details.model'
15 import { VideoService } from '../../shared/video/video.service'
16 import { VideoShareComponent } from './modal/video-share.component'
17 import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component'
18 import { I18n } from '@ngx-translate/i18n-polyfill'
19 import { environment } from '../../../environments/environment'
20 import { VideoCaptionService } from '@app/shared/video-caption'
21 import { MarkdownService } from '@app/shared/renderer'
22 import {
23 videojs,
24 CustomizationOptions,
25 P2PMediaLoaderOptions,
26 PeertubePlayerManager,
27 PeertubePlayerManagerOptions,
28 PlayerMode
29 } from '../../../assets/player/peertube-player-manager'
30 import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
31 import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service'
32 import { Video } from '@app/shared/video/video.model'
33 import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
34 import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
35 import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
36 import { PluginService } from '@app/core/plugins/plugin.service'
37 import { HooksService } from '@app/core/plugins/hooks.service'
38 import { PlatformLocation } from '@angular/common'
39 import { randomInt } from '@shared/core-utils/miscs/miscs'
40 import { RecommendedVideosComponent } from '../recommendations/recommended-videos.component'
41
42 @Component({
43 selector: 'my-video-watch',
44 templateUrl: './video-watch.component.html',
45 styleUrls: [ './video-watch.component.scss' ]
46 })
47 export class VideoWatchComponent implements OnInit, OnDestroy {
48 private static LOCAL_STORAGE_PRIVACY_CONCERN_KEY = 'video-watch-privacy-concern'
49 private static LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO = 'auto_play_next_video'
50
51 @ViewChild('videoWatchPlaylist', { static: true }) videoWatchPlaylist: VideoWatchPlaylistComponent
52 @ViewChild('videoShareModal', { static: false }) videoShareModal: VideoShareComponent
53 @ViewChild('videoSupportModal', { static: false }) videoSupportModal: VideoSupportComponent
54 @ViewChild('subscribeButton', { static: false }) subscribeButton: SubscribeButtonComponent
55
56 player: any
57 playerElement: HTMLVideoElement
58 theaterEnabled = false
59 userRating: UserVideoRateType = null
60 descriptionLoading = false
61
62 video: VideoDetails = null
63 videoCaptions: VideoCaption[] = []
64
65 playlist: VideoPlaylist = null
66
67 completeDescriptionShown = false
68 completeVideoDescription: string
69 shortVideoDescription: string
70 videoHTMLDescription = ''
71 likesBarTooltipText = ''
72 hasAlreadyAcceptedPrivacyConcern = false
73 remoteServerDown = false
74 hotkeys: Hotkey[] = []
75
76 private nextVideoUuid = ''
77 private currentTime: number
78 private paramsSub: Subscription
79 private queryParamsSub: Subscription
80 private configSub: Subscription
81
82 constructor (
83 private elementRef: ElementRef,
84 private changeDetector: ChangeDetectorRef,
85 private route: ActivatedRoute,
86 private router: Router,
87 private videoService: VideoService,
88 private playlistService: VideoPlaylistService,
89 private videoBlacklistService: VideoBlacklistService,
90 private confirmService: ConfirmService,
91 private metaService: MetaService,
92 private authService: AuthService,
93 private serverService: ServerService,
94 private restExtractor: RestExtractor,
95 private notifier: Notifier,
96 private pluginService: PluginService,
97 private markdownService: MarkdownService,
98 private zone: NgZone,
99 private redirectService: RedirectService,
100 private videoCaptionService: VideoCaptionService,
101 private i18n: I18n,
102 private hotkeysService: HotkeysService,
103 private hooks: HooksService,
104 private location: PlatformLocation,
105 @Inject(LOCALE_ID) private localeId: string
106 ) {}
107
108 get user () {
109 return this.authService.getUser()
110 }
111
112 async ngOnInit () {
113 this.configSub = this.serverService.configLoaded
114 .subscribe(() => {
115 if (
116 isWebRTCDisabled() ||
117 this.serverService.getConfig().tracker.enabled === false ||
118 peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
119 ) {
120 this.hasAlreadyAcceptedPrivacyConcern = true
121 }
122 })
123
124 this.paramsSub = this.route.params.subscribe(routeParams => {
125 const videoId = routeParams[ 'videoId' ]
126 if (videoId) this.loadVideo(videoId)
127
128 const playlistId = routeParams[ 'playlistId' ]
129 if (playlistId) this.loadPlaylist(playlistId)
130 })
131
132 this.queryParamsSub = this.route.queryParams.subscribe(queryParams => {
133 const videoId = queryParams[ 'videoId' ]
134 if (videoId) this.loadVideo(videoId)
135 })
136
137 this.initHotkeys()
138
139 this.theaterEnabled = getStoredTheater()
140
141 this.hooks.runAction('action:video-watch.init', 'video-watch')
142 }
143
144 ngOnDestroy () {
145 this.flushPlayer()
146
147 // Unsubscribe subscriptions
148 if (this.paramsSub) this.paramsSub.unsubscribe()
149 if (this.queryParamsSub) this.queryParamsSub.unsubscribe()
150
151 // Unbind hotkeys
152 this.hotkeysService.remove(this.hotkeys)
153 }
154
155 setLike () {
156 if (this.isUserLoggedIn() === false) return
157
158 // Already liked this video
159 if (this.userRating === 'like') this.setRating('none')
160 else this.setRating('like')
161 }
162
163 setDislike () {
164 if (this.isUserLoggedIn() === false) return
165
166 // Already disliked this video
167 if (this.userRating === 'dislike') this.setRating('none')
168 else this.setRating('dislike')
169 }
170
171 getRatePopoverText () {
172 if (this.isUserLoggedIn()) return undefined
173
174 return this.i18n('You need to be connected to rate this content.')
175 }
176
177 showMoreDescription () {
178 if (this.completeVideoDescription === undefined) {
179 return this.loadCompleteDescription()
180 }
181
182 this.updateVideoDescription(this.completeVideoDescription)
183 this.completeDescriptionShown = true
184 }
185
186 showLessDescription () {
187 this.updateVideoDescription(this.shortVideoDescription)
188 this.completeDescriptionShown = false
189 }
190
191 loadCompleteDescription () {
192 this.descriptionLoading = true
193
194 this.videoService.loadCompleteDescription(this.video.descriptionPath)
195 .subscribe(
196 description => {
197 this.completeDescriptionShown = true
198 this.descriptionLoading = false
199
200 this.shortVideoDescription = this.video.description
201 this.completeVideoDescription = description
202
203 this.updateVideoDescription(this.completeVideoDescription)
204 },
205
206 error => {
207 this.descriptionLoading = false
208 this.notifier.error(error.message)
209 }
210 )
211 }
212
213 showSupportModal () {
214 this.pausePlayer()
215
216 this.videoSupportModal.show()
217 }
218
219 showShareModal () {
220 this.pausePlayer()
221
222 this.videoShareModal.show(this.currentTime)
223 }
224
225 isUserLoggedIn () {
226 return this.authService.isLoggedIn()
227 }
228
229 getVideoTags () {
230 if (!this.video || Array.isArray(this.video.tags) === false) return []
231
232 return this.video.tags
233 }
234
235 onRecommendations (videos: Video[]) {
236 if (videos.length > 0) {
237 // Pick a random video until the recommendations are improved
238 this.nextVideoUuid = videos[randomInt(0,videos.length - 1)].uuid
239 }
240 }
241
242 onModalOpened () {
243 this.pausePlayer()
244 }
245
246 onVideoRemoved () {
247 this.redirectService.redirectToHomepage()
248 }
249
250 acceptedPrivacyConcern () {
251 peertubeLocalStorage.setItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true')
252 this.hasAlreadyAcceptedPrivacyConcern = true
253 }
254
255 isVideoToTranscode () {
256 return this.video && this.video.state.id === VideoState.TO_TRANSCODE
257 }
258
259 isVideoToImport () {
260 return this.video && this.video.state.id === VideoState.TO_IMPORT
261 }
262
263 hasVideoScheduledPublication () {
264 return this.video && this.video.scheduledUpdate !== undefined
265 }
266
267 isVideoBlur (video: Video) {
268 return video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
269 }
270
271 private loadVideo (videoId: string) {
272 // Video did not change
273 if (this.video && this.video.uuid === videoId) return
274
275 if (this.player) this.player.pause()
276
277 const videoObs = this.hooks.wrapObsFun(
278 this.videoService.getVideo.bind(this.videoService),
279 { videoId },
280 'video-watch',
281 'filter:api.video-watch.video.get.params',
282 'filter:api.video-watch.video.get.result'
283 )
284
285 // Video did change
286 forkJoin([
287 videoObs,
288 this.videoCaptionService.listCaptions(videoId)
289 ])
290 .pipe(
291 // If 401, the video is private or blacklisted so redirect to 404
292 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
293 )
294 .subscribe(([ video, captionsResult ]) => {
295 const queryParams = this.route.snapshot.queryParams
296
297 const urlOptions = {
298 startTime: queryParams.start,
299 stopTime: queryParams.stop,
300
301 muted: queryParams.muted,
302 loop: queryParams.loop,
303 subtitle: queryParams.subtitle,
304
305 playerMode: queryParams.mode,
306 peertubeLink: false
307 }
308
309 this.onVideoFetched(video, captionsResult.data, urlOptions)
310 .catch(err => this.handleError(err))
311 })
312 }
313
314 private loadPlaylist (playlistId: string) {
315 // Playlist did not change
316 if (this.playlist && this.playlist.uuid === playlistId) return
317
318 this.playlistService.getVideoPlaylist(playlistId)
319 .pipe(
320 // If 401, the video is private or blacklisted so redirect to 404
321 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
322 )
323 .subscribe(playlist => {
324 this.playlist = playlist
325
326 const videoId = this.route.snapshot.queryParams['videoId']
327 this.videoWatchPlaylist.loadPlaylistElements(playlist, !videoId)
328 })
329 }
330
331 private updateVideoDescription (description: string) {
332 this.video.description = description
333 this.setVideoDescriptionHTML()
334 .catch(err => console.error(err))
335 }
336
337 private async setVideoDescriptionHTML () {
338 this.videoHTMLDescription = await this.markdownService.textMarkdownToHTML(this.video.description)
339 }
340
341 private setVideoLikesBarTooltipText () {
342 this.likesBarTooltipText = this.i18n('{{likesNumber}} likes / {{dislikesNumber}} dislikes', {
343 likesNumber: this.video.likes,
344 dislikesNumber: this.video.dislikes
345 })
346 }
347
348 private handleError (err: any) {
349 const errorMessage: string = typeof err === 'string' ? err : err.message
350 if (!errorMessage) return
351
352 // Display a message in the video player instead of a notification
353 if (errorMessage.indexOf('from xs param') !== -1) {
354 this.flushPlayer()
355 this.remoteServerDown = true
356 this.changeDetector.detectChanges()
357
358 return
359 }
360
361 this.notifier.error(errorMessage)
362 }
363
364 private checkUserRating () {
365 // Unlogged users do not have ratings
366 if (this.isUserLoggedIn() === false) return
367
368 this.videoService.getUserVideoRating(this.video.id)
369 .subscribe(
370 ratingObject => {
371 if (ratingObject) {
372 this.userRating = ratingObject.rating
373 }
374 },
375
376 err => this.notifier.error(err.message)
377 )
378 }
379
380 private async onVideoFetched (
381 video: VideoDetails,
382 videoCaptions: VideoCaption[],
383 urlOptions: CustomizationOptions & { playerMode: PlayerMode }
384 ) {
385 this.video = video
386 this.videoCaptions = videoCaptions
387
388 // Re init attributes
389 this.descriptionLoading = false
390 this.completeDescriptionShown = false
391 this.remoteServerDown = false
392 this.currentTime = undefined
393
394 this.videoWatchPlaylist.updatePlaylistIndex(video)
395
396 if (this.isVideoBlur(this.video)) {
397 const res = await this.confirmService.confirm(
398 this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'),
399 this.i18n('Mature or explicit content')
400 )
401 if (res === false) return this.location.back()
402 }
403
404 // Flush old player if needed
405 this.flushPlayer()
406
407 // Build video element, because videojs removes it on dispose
408 const playerElementWrapper = this.elementRef.nativeElement.querySelector('#videojs-wrapper')
409 this.playerElement = document.createElement('video')
410 this.playerElement.className = 'video-js vjs-peertube-skin'
411 this.playerElement.setAttribute('playsinline', 'true')
412 playerElementWrapper.appendChild(this.playerElement)
413
414 const params = {
415 video: this.video,
416 videoCaptions,
417 urlOptions,
418 user: this.user
419 }
420 const { playerMode, playerOptions } = await this.hooks.wrapFun(
421 this.buildPlayerManagerOptions.bind(this),
422 params,
423 'video-watch',
424 'filter:internal.video-watch.player.build-options.params',
425 'filter:internal.video-watch.player.build-options.result'
426 )
427
428 this.zone.runOutsideAngular(async () => {
429 this.player = await PeertubePlayerManager.initialize(playerMode, playerOptions, player => this.player = player)
430 this.player.focus()
431
432 this.player.on('customError', ({ err }: { err: any }) => this.handleError(err))
433
434 this.player.on('timeupdate', () => {
435 this.currentTime = Math.floor(this.player.currentTime())
436 })
437
438 this.player.one('ended', () => {
439 if (this.playlist) {
440 if (
441 this.user && this.user.autoPlayNextVideoPlaylist ||
442 peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true'
443 ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
444 } else if (
445 this.user && this.user.autoPlayNextVideo ||
446 peertubeLocalStorage.getItem(RecommendedVideosComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO) === 'true'
447 ) {
448 this.zone.run(() => this.autoplayNext())
449 }
450 })
451
452 this.player.one('stopped', () => {
453 if (this.playlist) {
454 if (
455 this.user && this.user.autoPlayNextVideoPlaylist ||
456 peertubeLocalStorage.getItem(VideoWatchPlaylistComponent.LOCAL_STORAGE_AUTO_PLAY_NEXT_VIDEO_PLAYLIST) === 'true'
457 ) this.zone.run(() => this.videoWatchPlaylist.navigateToNextPlaylistVideo())
458 }
459 })
460
461 this.player.on('theaterChange', (_: any, enabled: boolean) => {
462 this.zone.run(() => this.theaterEnabled = enabled)
463 })
464
465 this.hooks.runAction('action:video-watch.player.loaded', 'video-watch', { player: this.player })
466 })
467
468 this.setVideoDescriptionHTML()
469 this.setVideoLikesBarTooltipText()
470
471 this.setOpenGraphTags()
472 this.checkUserRating()
473
474 this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', { videojs })
475 }
476
477 private autoplayNext () {
478 if (this.nextVideoUuid) {
479 this.router.navigate([ '/videos/watch', this.nextVideoUuid ])
480 }
481 }
482
483 private setRating (nextRating: UserVideoRateType) {
484 const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable<any> } = {
485 like: this.videoService.setVideoLike,
486 dislike: this.videoService.setVideoDislike,
487 none: this.videoService.unsetVideoLike
488 }
489
490 ratingMethods[nextRating].call(this.videoService, this.video.id)
491 .subscribe(
492 () => {
493 // Update the video like attribute
494 this.updateVideoRating(this.userRating, nextRating)
495 this.userRating = nextRating
496 },
497
498 (err: { message: string }) => this.notifier.error(err.message)
499 )
500 }
501
502 private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) {
503 let likesToIncrement = 0
504 let dislikesToIncrement = 0
505
506 if (oldRating) {
507 if (oldRating === 'like') likesToIncrement--
508 if (oldRating === 'dislike') dislikesToIncrement--
509 }
510
511 if (newRating === 'like') likesToIncrement++
512 if (newRating === 'dislike') dislikesToIncrement++
513
514 this.video.likes += likesToIncrement
515 this.video.dislikes += dislikesToIncrement
516
517 this.video.buildLikeAndDislikePercents()
518 this.setVideoLikesBarTooltipText()
519 }
520
521 private setOpenGraphTags () {
522 this.metaService.setTitle(this.video.name)
523
524 this.metaService.setTag('og:type', 'video')
525
526 this.metaService.setTag('og:title', this.video.name)
527 this.metaService.setTag('name', this.video.name)
528
529 this.metaService.setTag('og:description', this.video.description)
530 this.metaService.setTag('description', this.video.description)
531
532 this.metaService.setTag('og:image', this.video.previewPath)
533
534 this.metaService.setTag('og:duration', this.video.duration.toString())
535
536 this.metaService.setTag('og:site_name', 'PeerTube')
537
538 this.metaService.setTag('og:url', window.location.href)
539 this.metaService.setTag('url', window.location.href)
540 }
541
542 private isAutoplay () {
543 // We'll jump to the thread id, so do not play the video
544 if (this.route.snapshot.params['threadId']) return false
545
546 // Otherwise true by default
547 if (!this.user) return true
548
549 // Be sure the autoPlay is set to false
550 return this.user.autoPlayVideo !== false
551 }
552
553 private flushPlayer () {
554 // Remove player if it exists
555 if (this.player) {
556 try {
557 this.player.dispose()
558 this.player = undefined
559 } catch (err) {
560 console.error('Cannot dispose player.', err)
561 }
562 }
563 }
564
565 private buildPlayerManagerOptions (params: {
566 video: VideoDetails,
567 videoCaptions: VideoCaption[],
568 urlOptions: CustomizationOptions & { playerMode: PlayerMode },
569 user?: AuthUser
570 }) {
571 const { video, videoCaptions, urlOptions, user } = params
572
573 let startTime = timeToInt(urlOptions.startTime) || (video.userHistory ? video.userHistory.currentTime : 0)
574 // If we are at the end of the video, reset the timer
575 if (video.duration - startTime <= 1) startTime = 0
576
577 const playerCaptions = videoCaptions.map(c => ({
578 label: c.language.label,
579 language: c.language.id,
580 src: environment.apiUrl + c.captionPath
581 }))
582
583 const options: PeertubePlayerManagerOptions = {
584 common: {
585 autoplay: this.isAutoplay(),
586
587 playerElement: this.playerElement,
588 onPlayerElementChange: (element: HTMLVideoElement) => this.playerElement = element,
589
590 videoDuration: video.duration,
591 enableHotkeys: true,
592 inactivityTimeout: 2500,
593 poster: video.previewUrl,
594
595 startTime,
596 stopTime: urlOptions.stopTime,
597 controls: urlOptions.controls,
598 muted: urlOptions.muted,
599 loop: urlOptions.loop,
600 subtitle: urlOptions.subtitle,
601
602 peertubeLink: urlOptions.peertubeLink,
603
604 theaterButton: true,
605 captions: videoCaptions.length !== 0,
606
607 videoViewUrl: video.privacy.id !== VideoPrivacy.PRIVATE
608 ? this.videoService.getVideoViewUrl(video.uuid)
609 : null,
610 embedUrl: video.embedUrl,
611
612 language: this.localeId,
613
614 userWatching: user && user.videosHistoryEnabled === true ? {
615 url: this.videoService.getUserWatchingVideoUrl(video.uuid),
616 authorizationHeader: this.authService.getRequestHeaderValue()
617 } : undefined,
618
619 serverUrl: environment.apiUrl,
620
621 videoCaptions: playerCaptions
622 },
623
624 webtorrent: {
625 videoFiles: video.files
626 }
627 }
628
629 let mode: PlayerMode
630
631 if (urlOptions.playerMode) {
632 if (urlOptions.playerMode === 'p2p-media-loader') mode = 'p2p-media-loader'
633 else mode = 'webtorrent'
634 } else {
635 if (video.hasHlsPlaylist()) mode = 'p2p-media-loader'
636 else mode = 'webtorrent'
637 }
638
639 if (mode === 'p2p-media-loader') {
640 const hlsPlaylist = video.getHlsPlaylist()
641
642 const p2pMediaLoader = {
643 playlistUrl: hlsPlaylist.playlistUrl,
644 segmentsSha256Url: hlsPlaylist.segmentsSha256Url,
645 redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl),
646 trackerAnnounce: video.trackerUrls,
647 videoFiles: hlsPlaylist.files
648 } as P2PMediaLoaderOptions
649
650 Object.assign(options, { p2pMediaLoader })
651 }
652
653 return { playerMode: mode, playerOptions: options }
654 }
655
656 private pausePlayer () {
657 if (!this.player) return
658
659 this.player.pause()
660 }
661
662 private initHotkeys () {
663 this.hotkeys = [
664 // These hotkeys are managed by the player
665 new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')),
666 new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')),
667 new Hotkey('m', e => e, undefined, this.i18n('Mute/unmute the video (requires player focus)')),
668
669 new Hotkey('0-9', e => e, undefined, this.i18n('Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)')),
670
671 new Hotkey('up', e => e, undefined, this.i18n('Increase the volume (requires player focus)')),
672 new Hotkey('down', e => e, undefined, this.i18n('Decrease the volume (requires player focus)')),
673
674 new Hotkey('right', e => e, undefined, this.i18n('Seek the video forward (requires player focus)')),
675 new Hotkey('left', e => e, undefined, this.i18n('Seek the video backward (requires player focus)')),
676
677 new Hotkey('>', e => e, undefined, this.i18n('Increase playback rate (requires player focus)')),
678 new Hotkey('<', e => e, undefined, this.i18n('Decrease playback rate (requires player focus)')),
679
680 new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)'))
681 ]
682
683 if (this.isUserLoggedIn()) {
684 this.hotkeys = this.hotkeys.concat([
685 new Hotkey('shift+l', () => {
686 this.setLike()
687 return false
688 }, undefined, this.i18n('Like the video')),
689
690 new Hotkey('shift+d', () => {
691 this.setDislike()
692 return false
693 }, undefined, this.i18n('Dislike the video')),
694
695 new Hotkey('shift+s', () => {
696 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
697 return false
698 }, undefined, this.i18n('Subscribe to the account'))
699 ])
700 }
701
702 this.hotkeysService.add(this.hotkeys)
703 }
704 }