From b8cb1d8e87c15bffba7ebc32dafc1d172ec9a259 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Aug 2024 13:43:55 +0200 Subject: [PATCH] Smoother live autoplay Avoid blank page --- .../app/+videos/+video-watch/video-watch.component.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 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 40547bc15..3121a4723 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -317,13 +317,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { private loadVideo (options: { videoId: string forceAutoplay: boolean + liveRefresh?: boolean videoPassword?: string }) { - const { videoId, forceAutoplay, videoPassword } = options + const { videoId, liveRefresh, forceAutoplay, videoPassword } = options - if (this.isSameElement(this.video, videoId)) return - - this.video = undefined + if (!liveRefresh && this.isSameElement(this.video, videoId)) return const videoObs = this.hooks.wrapObsFun( this.videoService.getVideo.bind(this.videoService), @@ -895,9 +894,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { const videoUUID = this.video.uuid - // Reset to force refresh the video - this.video = undefined - this.loadVideo({ videoId: videoUUID, forceAutoplay: true }) + this.loadVideo({ videoId: videoUUID, forceAutoplay: true, liveRefresh: true }) } private handleLiveViewsChange (newViewers: number) {