diff options
Diffstat (limited to 'client/src/standalone/videos/shared/live-manager.ts')
-rw-r--r-- | client/src/standalone/videos/shared/live-manager.ts | 15 |
1 files changed, 6 insertions, 9 deletions
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 { | |||
14 | 14 | ||
15 | } | 15 | } |
16 | 16 | ||
17 | async displayInfoAndListenForChanges (options: { | 17 | async listenForChanges (options: { |
18 | video: VideoDetails | 18 | video: VideoDetails |
19 | translations: Translations | ||
20 | onPublishedVideo: () => any | 19 | onPublishedVideo: () => any |
21 | }) { | 20 | }) { |
22 | const { video, onPublishedVideo } = options | 21 | const { video, onPublishedVideo } = options |
23 | 22 | ||
24 | this.displayAppropriateInfo(options) | ||
25 | |||
26 | if (!this.liveSocket) { | 23 | if (!this.liveSocket) { |
27 | const io = (await import('socket.io-client')).io | 24 | const io = (await import('socket.io-client')).io |
28 | this.liveSocket = io(window.location.origin + '/live-videos') | 25 | this.liveSocket = io(window.location.origin + '/live-videos') |
@@ -51,18 +48,18 @@ export class LiveManager { | |||
51 | this.liveSocket.emit('unsubscribe', { videoId: video.id }) | 48 | this.liveSocket.emit('unsubscribe', { videoId: video.id }) |
52 | } | 49 | } |
53 | 50 | ||
54 | private displayAppropriateInfo (options: { | 51 | displayInfo (options: { |
55 | video: VideoDetails | 52 | state: VideoState |
56 | translations: Translations | 53 | translations: Translations |
57 | }) { | 54 | }) { |
58 | const { video, translations } = options | 55 | const { state, translations } = options |
59 | 56 | ||
60 | if (video.state.id === VideoState.WAITING_FOR_LIVE) { | 57 | if (state === VideoState.WAITING_FOR_LIVE) { |
61 | this.displayWaitingForLiveInfo(translations) | 58 | this.displayWaitingForLiveInfo(translations) |
62 | return | 59 | return |
63 | } | 60 | } |
64 | 61 | ||
65 | if (video.state.id === VideoState.LIVE_ENDED) { | 62 | if (state === VideoState.LIVE_ENDED) { |
66 | this.displayEndedLiveInfo(translations) | 63 | this.displayEndedLiveInfo(translations) |
67 | return | 64 | return |
68 | } | 65 | } |