diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-24 10:44:25 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-24 10:44:25 +0200 |
commit | 91a4893063402d7beabb3104f9b989b8f88b6038 (patch) | |
tree | ef6ed9611babdf4b29838de337fee0584de0f895 /client/src/standalone | |
parent | d50e8d1aee3d563796ec1e184e094cdc937d0d77 (diff) | |
parent | b1934b7e9cdece7c0c38e05b0f905dc2ccab9167 (diff) | |
download | PeerTube-91a4893063402d7beabb3104f9b989b8f88b6038.tar.gz PeerTube-91a4893063402d7beabb3104f9b989b8f88b6038.tar.zst PeerTube-91a4893063402d7beabb3104f9b989b8f88b6038.zip |
Merge branch 'release/4.3.0' into develop
Diffstat (limited to 'client/src/standalone')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 1 | ||||
-rw-r--r-- | client/src/standalone/videos/shared/live-manager.ts | 14 | ||||
-rw-r--r-- | client/src/standalone/videos/shared/player-html.ts | 3 |
3 files changed, 16 insertions, 2 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 5384ada1c..451e54840 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -259,6 +259,7 @@ export class PeerTubeEmbed { | |||
259 | 259 | ||
260 | if (this.player) { | 260 | if (this.player) { |
261 | this.player.dispose() | 261 | this.player.dispose() |
262 | this.player = undefined | ||
262 | alreadyHadPlayer = true | 263 | alreadyHadPlayer = true |
263 | } | 264 | } |
264 | 265 | ||
diff --git a/client/src/standalone/videos/shared/live-manager.ts b/client/src/standalone/videos/shared/live-manager.ts index 422d39793..ec11d0b61 100644 --- a/client/src/standalone/videos/shared/live-manager.ts +++ b/client/src/standalone/videos/shared/live-manager.ts | |||
@@ -6,6 +6,8 @@ import { Translations } from './translations' | |||
6 | export class LiveManager { | 6 | export class LiveManager { |
7 | private liveSocket: Socket | 7 | private liveSocket: Socket |
8 | 8 | ||
9 | private listeners = new Map<string, (payload: LiveVideoEventPayload) => void>() | ||
10 | |||
9 | constructor ( | 11 | constructor ( |
10 | private readonly playerHTML: PlayerHTML | 12 | private readonly playerHTML: PlayerHTML |
11 | ) { | 13 | ) { |
@@ -26,18 +28,26 @@ export class LiveManager { | |||
26 | this.liveSocket = io(window.location.origin + '/live-videos') | 28 | this.liveSocket = io(window.location.origin + '/live-videos') |
27 | } | 29 | } |
28 | 30 | ||
29 | this.liveSocket.on('state-change', (payload: LiveVideoEventPayload) => { | 31 | const listener = (payload: LiveVideoEventPayload) => { |
30 | if (payload.state === VideoState.PUBLISHED) { | 32 | if (payload.state === VideoState.PUBLISHED) { |
31 | this.playerHTML.removeInformation() | 33 | this.playerHTML.removeInformation() |
32 | onPublishedVideo() | 34 | onPublishedVideo() |
33 | return | 35 | return |
34 | } | 36 | } |
35 | }) | 37 | } |
38 | |||
39 | this.liveSocket.on('state-change', listener) | ||
40 | this.listeners.set(video.uuid, listener) | ||
36 | 41 | ||
37 | this.liveSocket.emit('subscribe', { videoId: video.id }) | 42 | this.liveSocket.emit('subscribe', { videoId: video.id }) |
38 | } | 43 | } |
39 | 44 | ||
40 | stopListeningForChanges (video: VideoDetails) { | 45 | stopListeningForChanges (video: VideoDetails) { |
46 | const listener = this.listeners.get(video.uuid) | ||
47 | if (listener) { | ||
48 | this.liveSocket.off('state-change', listener) | ||
49 | } | ||
50 | |||
41 | this.liveSocket.emit('unsubscribe', { videoId: video.id }) | 51 | this.liveSocket.emit('unsubscribe', { videoId: video.id }) |
42 | } | 52 | } |
43 | 53 | ||
diff --git a/client/src/standalone/videos/shared/player-html.ts b/client/src/standalone/videos/shared/player-html.ts index 61231d2cb..d93678c10 100644 --- a/client/src/standalone/videos/shared/player-html.ts +++ b/client/src/standalone/videos/shared/player-html.ts | |||
@@ -79,7 +79,10 @@ export class PlayerHTML { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | removeInformation () { | 81 | removeInformation () { |
82 | if (!this.informationElement) return | ||
83 | |||
82 | this.removeElement(this.informationElement) | 84 | this.removeElement(this.informationElement) |
85 | this.informationElement = undefined | ||
83 | } | 86 | } |
84 | 87 | ||
85 | private getPlaceholderElement () { | 88 | private getPlaceholderElement () { |