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 | 13 |
1 files changed, 12 insertions, 1 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 5530dc8ad..107826824 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -188,7 +188,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
188 | }) | 188 | }) |
189 | 189 | ||
190 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { | 190 | this.queryParamsSub = this.route.queryParams.subscribe(queryParams => { |
191 | this.playlistPosition = queryParams[ 'playlistPosition' ] | 191 | // Handle the ?playlistPosition |
192 | const positionParam = queryParams[ 'playlistPosition' ] | ||
193 | |||
194 | this.playlistPosition = positionParam === 'last' | ||
195 | ? -1 // Handle the "last" index | ||
196 | : parseInt(positionParam, 10) | ||
197 | |||
198 | if (isNaN(this.playlistPosition)) { | ||
199 | console.error(`playlistPosition query param '${positionParam}' was parsed as NaN, defaulting to 1.`) | ||
200 | this.playlistPosition = 1 | ||
201 | } | ||
202 | |||
192 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) | 203 | this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition) |
193 | 204 | ||
194 | const start = queryParams[ 'start' ] | 205 | const start = queryParams[ 'start' ] |