Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix playlist start time of element 1

Chocobozzz167d36df631f
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts
index 70e040b2b1..1bb186929e 100644
--- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts
@@ -118,6 +118,7 @@ export class VideoWatchPlaylistComponent {
if (position) this.updatePlaylistIndex(position)
if (redirectToFirst) {
+ console.log(firstAvailableVideo)
const extras = {
queryParams: {
start: firstAvailableVideo.startTimestamp,
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 daa5cdfcf8..e68fd91f7b 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -293,7 +293,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
private loadRouteQuery () {
this.queryParamsSub = this.route.queryParams.subscribe(queryParams => {
// Handle the ?playlistPosition
- const positionParam = queryParams['playlistPosition'] ?? 1
+ const positionParam = queryParams['playlistPosition']
+ if (!positionParam) return
this.playlistPosition = positionParam === 'last'
? -1 // Handle the "last" index
@@ -307,7 +308,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.videoWatchPlaylist.updatePlaylistIndex(this.playlistPosition)
const start = queryParams['start']
- if (this.peertubePlayer && start) this.peertubePlayer.getPlayer().currentTime(parseInt(start, 10))
+ if (this.peertubePlayer?.getPlayer() && start) {
+ this.peertubePlayer.getPlayer().currentTime(parseInt(start, 10))
+ }
})
}