diff options
Diffstat (limited to 'client/src/app/+videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 39 |
1 files changed, 20 insertions, 19 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 85100b653..2007bdecb 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -195,10 +195,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
195 | 195 | ||
196 | private loadRouteParams () { | 196 | private loadRouteParams () { |
197 | this.paramsSub = this.route.params.subscribe(routeParams => { | 197 | this.paramsSub = this.route.params.subscribe(routeParams => { |
198 | const videoId = routeParams[ 'videoId' ] | 198 | const videoId = routeParams['videoId'] |
199 | if (videoId) return this.loadVideo(videoId) | 199 | if (videoId) return this.loadVideo(videoId) |
200 | 200 | ||
201 | const playlistId = routeParams[ 'playlistId' ] | 201 | const playlistId = routeParams['playlistId'] |
202 | if (playlistId) return this.loadPlaylist(playlistId) | 202 | if (playlistId) return this.loadPlaylist(playlistId) |
203 | }) | 203 | }) |
204 | } | 204 | } |
@@ -206,7 +206,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
206 | private loadRouteQuery () { | 206 | private loadRouteQuery () { |
207 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { | 207 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { |
208 | // Handle the ?playlistPosition | 208 | // Handle the ?playlistPosition |
209 | const positionParam = queryParams[ 'playlistPosition' ] ?? 1 | 209 | const positionParam = queryParams['playlistPosition'] ?? 1 |
210 | 210 | ||
211 | this.playlistPosition = positionParam === 'last' | 211 | this.playlistPosition = positionParam === 'last' |
212 | ? -1 // Handle the "last" index | 212 | ? -1 // Handle the "last" index |
@@ -219,7 +219,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
219 | 219 | ||
220 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) | 220 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) |
221 | 221 | ||
222 | const start = queryParams[ 'start' ] | 222 | const start = queryParams['start'] |
223 | if (this.player && start) this.player.currentTime(parseInt(start, 10)) | 223 | if (this.player && start) this.player.currentTime(parseInt(start, 10)) |
224 | }) | 224 | }) |
225 | } | 225 | } |
@@ -237,7 +237,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
237 | 'filter:api.video-watch.video.get.result' | 237 | 'filter:api.video-watch.video.get.result' |
238 | ) | 238 | ) |
239 | 239 | ||
240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId)]) | 240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId) ]) |
241 | .subscribe({ | 241 | .subscribe({ |
242 | next: ([ video, captionsResult ]) => { | 242 | next: ([ video, captionsResult ]) => { |
243 | const queryParams = this.route.snapshot.queryParams | 243 | const queryParams = this.route.snapshot.queryParams |
@@ -292,6 +292,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
292 | const originUrl = errorBody.originUrl + (window.location.search ?? '') | 292 | const originUrl = errorBody.originUrl + (window.location.search ?? '') |
293 | 293 | ||
294 | const res = await this.confirmService.confirm( | 294 | const res = await this.confirmService.confirm( |
295 | // eslint-disable-next-line max-len | ||
295 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, | 296 | $localize`This video is not available on this instance. Do you want to be redirected on the origin instance: <a href="${originUrl}">${originUrl}</a>?`, |
296 | $localize`Redirection` | 297 | $localize`Redirection` |
297 | ) | 298 | ) |
@@ -312,7 +313,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
312 | if (!errorMessage) return | 313 | if (!errorMessage) return |
313 | 314 | ||
314 | // Display a message in the video player instead of a notification | 315 | // Display a message in the video player instead of a notification |
315 | if (errorMessage.indexOf('from xs param') !== -1) { | 316 | if (errorMessage.includes('from xs param')) { |
316 | this.flushPlayer() | 317 | this.flushPlayer() |
317 | this.remoteServerDown = true | 318 | this.remoteServerDown = true |
318 | 319 | ||
@@ -466,7 +467,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
466 | 467 | ||
467 | if (this.nextVideoUUID) { | 468 | if (this.nextVideoUUID) { |
468 | this.router.navigate([ '/w', this.nextVideoUUID ]) | 469 | this.router.navigate([ '/w', this.nextVideoUUID ]) |
469 | return | ||
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
@@ -483,14 +483,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
483 | 483 | ||
484 | private isAutoPlayNext () { | 484 | private isAutoPlayNext () { |
485 | return ( | 485 | return ( |
486 | (this.user && this.user.autoPlayNextVideo) || | 486 | (this.user?.autoPlayNextVideo) || |
487 | this.anonymousUser.autoPlayNextVideo | 487 | this.anonymousUser.autoPlayNextVideo |
488 | ) | 488 | ) |
489 | } | 489 | } |
490 | 490 | ||
491 | private isPlaylistAutoPlayNext () { | 491 | private isPlaylistAutoPlayNext () { |
492 | return ( | 492 | return ( |
493 | (this.user && this.user.autoPlayNextVideoPlaylist) || | 493 | (this.user?.autoPlayNextVideoPlaylist) || |
494 | this.anonymousUser.autoPlayNextVideoPlaylist | 494 | this.anonymousUser.autoPlayNextVideoPlaylist |
495 | ) | 495 | ) |
496 | } | 496 | } |
@@ -508,9 +508,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
508 | } | 508 | } |
509 | 509 | ||
510 | private buildPlayerManagerOptions (params: { | 510 | private buildPlayerManagerOptions (params: { |
511 | video: VideoDetails, | 511 | video: VideoDetails |
512 | videoCaptions: VideoCaption[], | 512 | videoCaptions: VideoCaption[] |
513 | urlOptions: CustomizationOptions & { playerMode: PlayerMode }, | 513 | urlOptions: CustomizationOptions & { playerMode: PlayerMode } |
514 | user?: AuthUser | 514 | user?: AuthUser |
515 | }) { | 515 | }) { |
516 | const { video, videoCaptions, urlOptions, user } = params | 516 | const { video, videoCaptions, urlOptions, user } = params |
@@ -573,10 +573,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
573 | 573 | ||
574 | language: this.localeId, | 574 | language: this.localeId, |
575 | 575 | ||
576 | userWatching: user && user.videosHistoryEnabled === true ? { | 576 | userWatching: user && user.videosHistoryEnabled === true |
577 | url: this.videoService.getUserWatchingVideoUrl(video.uuid), | 577 | ? { |
578 | authorizationHeader: this.authService.getRequestHeaderValue() | 578 | url: this.videoService.getUserWatchingVideoUrl(video.uuid), |
579 | } : undefined, | 579 | authorizationHeader: this.authService.getRequestHeaderValue() |
580 | } | ||
581 | : undefined, | ||
580 | 582 | ||
581 | serverUrl: environment.apiUrl, | 583 | serverUrl: environment.apiUrl, |
582 | 584 | ||
@@ -704,9 +706,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
704 | if (this.isUserLoggedIn()) { | 706 | if (this.isUserLoggedIn()) { |
705 | this.hotkeys = this.hotkeys.concat([ | 707 | this.hotkeys = this.hotkeys.concat([ |
706 | new Hotkey('shift+s', () => { | 708 | new Hotkey('shift+s', () => { |
707 | this.subscribeButton.isSubscribedToAll() | 709 | if (this.subscribeButton.isSubscribedToAll()) this.subscribeButton.unsubscribe() |
708 | ? this.subscribeButton.unsubscribe() | 710 | else this.subscribeButton.subscribe() |
709 | : this.subscribeButton.subscribe() | ||
710 | 711 | ||
711 | return false | 712 | return false |
712 | }, undefined, $localize`Subscribe to the account`) | 713 | }, undefined, $localize`Subscribe to the account`) |