- this.serverConfig = this.serverService.getTmpConfig()
-
- this.configSub = this.serverService.getConfig()
- .subscribe(config => {
- this.serverConfig = config
-
- if (
- isWebRTCDisabled() ||
- this.serverConfig.tracker.enabled === false ||
- getStoredP2PEnabled() === false ||
- peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true'
- ) {
- this.hasAlreadyAcceptedPrivacyConcern = true
- }
- })
-
- this.paramsSub = this.route.params.subscribe(routeParams => {
- const videoId = routeParams[ 'videoId' ]
- if (videoId) this.loadVideo(videoId)
-
- const playlistId = routeParams[ 'playlistId' ]
- if (playlistId) this.loadPlaylist(playlistId)
- })
-
- this.queryParamsSub = this.route.queryParams.subscribe(queryParams => {
- // Handle the ?playlistPosition
- const positionParam = queryParams[ 'playlistPosition' ] ?? 1
-
- this.playlistPosition = positionParam === 'last'
- ? -1 // Handle the "last" index
- : parseInt(positionParam + '', 10)
-
- if (isNaN(this.playlistPosition)) {
- console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`)
- this.playlistPosition = 1
- }
-
- this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition)
-
- const start = queryParams[ 'start' ]
- if (this.player && start) this.player.currentTime(parseInt(start, 10))
- })