Fix playlist start time of element 1

pull/6288/head
Chocobozzz 2024-03-19 11:29:04 +01:00
parent 128748e6e4
commit 167d36df63
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 6 additions and 2 deletions

View File

@ -118,6 +118,7 @@ export class VideoWatchPlaylistComponent {
if (position) this.updatePlaylistIndex(position)
if (redirectToFirst) {
console.log(firstAvailableVideo)
const extras = {
queryParams: {
start: firstAvailableVideo.startTimestamp,

View File

@ -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))
}
})
}