+ isVideoBlur (video: Video) {
+ return video.isVideoNSFWForUser(this.user, this.serverService.getConfig())
+ }
+
+ private loadVideo (videoId: string) {
+ // Video did not change
+ if (this.video && this.video.uuid === videoId) return
+
+ if (this.player) this.player.pause()
+
+ const videoObs = this.hooks.wrapObsFun(
+ this.videoService.getVideo.bind(this.videoService),
+ { videoId },
+ 'video-watch',
+ 'filter:api.video-watch.video.get.params',
+ 'filter:api.video-watch.video.get.result'
+ )
+
+ // Video did change
+ forkJoin([
+ videoObs,
+ this.videoCaptionService.listCaptions(videoId)
+ ])
+ .pipe(
+ // If 401, the video is private or blacklisted so redirect to 404
+ catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
+ )
+ .subscribe(([ video, captionsResult ]) => {
+ const queryParams = this.route.snapshot.queryParams
+
+ const urlOptions = {
+ startTime: queryParams.start,
+ stopTime: queryParams.stop,
+
+ muted: queryParams.muted,
+ loop: queryParams.loop,
+ subtitle: queryParams.subtitle,
+
+ playerMode: queryParams.mode,
+ peertubeLink: false
+ }
+
+ this.onVideoFetched(video, captionsResult.data, urlOptions)
+ .catch(err => this.handleError(err))
+ })
+ }
+
+ private loadPlaylist (playlistId: string) {
+ // Playlist did not change
+ if (this.playlist && this.playlist.uuid === playlistId) return
+
+ this.playlistService.getVideoPlaylist(playlistId)
+ .pipe(
+ // If 401, the video is private or blacklisted so redirect to 404
+ catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 401, 403, 404 ]))
+ )
+ .subscribe(playlist => {
+ this.playlist = playlist
+
+ const videoId = this.route.snapshot.queryParams['videoId']
+ this.videoWatchPlaylist.loadPlaylistElements(playlist, !videoId)
+ })
+ }
+