Smoother live autoplay

Avoid blank page
pull/6544/head
Chocobozzz 2024-08-08 13:43:55 +02:00
parent 64f943c1cb
commit b8cb1d8e87
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 4 additions and 7 deletions

View File

@ -317,13 +317,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
private loadVideo (options: { private loadVideo (options: {
videoId: string videoId: string
forceAutoplay: boolean forceAutoplay: boolean
liveRefresh?: boolean
videoPassword?: string videoPassword?: string
}) { }) {
const { videoId, forceAutoplay, videoPassword } = options const { videoId, liveRefresh, forceAutoplay, videoPassword } = options
if (this.isSameElement(this.video, videoId)) return if (!liveRefresh && this.isSameElement(this.video, videoId)) return
this.video = undefined
const videoObs = this.hooks.wrapObsFun( const videoObs = this.hooks.wrapObsFun(
this.videoService.getVideo.bind(this.videoService), this.videoService.getVideo.bind(this.videoService),
@ -895,9 +894,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
const videoUUID = this.video.uuid const videoUUID = this.video.uuid
// Reset to force refresh the video this.loadVideo({ videoId: videoUUID, forceAutoplay: true, liveRefresh: true })
this.video = undefined
this.loadVideo({ videoId: videoUUID, forceAutoplay: true })
} }
private handleLiveViewsChange (newViewers: number) { private handleLiveViewsChange (newViewers: number) {