From e772bdf14c46701552491dc337a21325c34e1ec2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Dec 2020 15:29:18 +0100 Subject: Load video in permanent live after last one ended --- .../src/app/+videos/+video-watch/video-watch.component.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'client/src/app/+videos') 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 66af9709d..b15de2a79 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -607,6 +607,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } }) + this.player.one('ended', () => { + if (this.video.isLive) { + this.video.state.id = VideoState.LIVE_ENDED + } + }) + this.player.on('theaterChange', (_: any, enabled: boolean) => { this.zone.run(() => this.theaterEnabled = enabled) }) @@ -844,7 +850,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { if (!this.liveVideosSub) { this.liveVideosSub = this.peertubeSocket.getLiveVideosObservable() .subscribe(({ payload }) => { - if (payload.state !== VideoState.PUBLISHED || this.video.state.id !== VideoState.WAITING_FOR_LIVE) return + if (payload.state !== VideoState.PUBLISHED) return + + const videoState = this.video.state.id + if (videoState !== VideoState.WAITING_FOR_LIVE && videoState !== VideoState.LIVE_ENDED) return + + console.log('Loading video after live update.') const videoUUID = this.video.uuid -- cgit v1.2.3