From c2419476302b20e9fe3708d7a0a889ae18c95c1b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Nov 2022 08:55:27 +0100 Subject: Correctly terminate an ended live --- client/src/standalone/videos/shared/live-manager.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'client/src/standalone/videos/shared') diff --git a/client/src/standalone/videos/shared/live-manager.ts b/client/src/standalone/videos/shared/live-manager.ts index ec11d0b61..5fac229ba 100644 --- a/client/src/standalone/videos/shared/live-manager.ts +++ b/client/src/standalone/videos/shared/live-manager.ts @@ -14,15 +14,12 @@ export class LiveManager { } - async displayInfoAndListenForChanges (options: { + async listenForChanges (options: { video: VideoDetails - translations: Translations onPublishedVideo: () => any }) { const { video, onPublishedVideo } = options - this.displayAppropriateInfo(options) - if (!this.liveSocket) { const io = (await import('socket.io-client')).io this.liveSocket = io(window.location.origin + '/live-videos') @@ -51,18 +48,18 @@ export class LiveManager { this.liveSocket.emit('unsubscribe', { videoId: video.id }) } - private displayAppropriateInfo (options: { - video: VideoDetails + displayInfo (options: { + state: VideoState translations: Translations }) { - const { video, translations } = options + const { state, translations } = options - if (video.state.id === VideoState.WAITING_FOR_LIVE) { + if (state === VideoState.WAITING_FOR_LIVE) { this.displayWaitingForLiveInfo(translations) return } - if (video.state.id === VideoState.LIVE_ENDED) { + if (state === VideoState.LIVE_ENDED) { this.displayEndedLiveInfo(translations) return } -- cgit v1.2.3