Fix live start time

Use undefined to not break live edge position set by hls.js
pull/6026/head
Chocobozzz 2023-10-30 11:04:26 +01:00
parent 19dbbdafcc
commit a12d94f30d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 8 additions and 3 deletions

View File

@ -695,6 +695,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
const getStartTime = () => {
if (video.isLive) return undefined
const byUrl = urlOptions.startTime !== undefined
const byHistory = video.userHistory && (!this.playlist || urlOptions.resume !== undefined)
const byLocalStorage = getStoredVideoWatchHistory(video.uuid)

View File

@ -409,10 +409,13 @@ class PeerTubePlugin extends Plugin {
// Prefer canplaythrough instead of canplay because Chrome has issues with the second one
this.player.one('canplaythrough', () => {
const startTime = this.options.startTime() || 0
debugLogger('Start the video at ' + startTime)
const startTime = this.options.startTime()
this.player.currentTime(timeToInt(startTime))
if (startTime !== null && startTime !== undefined) {
debugLogger('Start the video at ' + startTime)
this.player.currentTime(timeToInt(startTime))
}
if (this.options.stopTime()) {
const stopTime = timeToInt(this.options.stopTime())