Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Unsubscribe live events on destroy

Chocobozzz94a65abe5eb9
diff --git a/client/src/app/+video-watch/video-watch.component.ts b/client/src/app/+video-watch/video-watch.component.ts
index 83b99d0f2b..9c1930f266 100644
--- a/client/src/app/+video-watch/video-watch.component.ts
+++ b/client/src/app/+video-watch/video-watch.component.ts
@@ -260,6 +260,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
if (this.configSub) this.configSub.unsubscribe()
if (this.liveVideosSub) this.liveVideosSub.unsubscribe()
+ if (this.video?.isLive) this.peertubeSocket.unsubscribeLiveVideos(this.video.id)
+
// Unbind hotkeys
this.hotkeysService.remove(this.hotkeys)
@@ -967,16 +969,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
}
private async subscribeToLiveEventsIfNeeded (oldVideo: VideoDetails, newVideo: VideoDetails) {
- if (!this.liveVideosSub) {
- this.liveVideosSub = this.buildLiveEventsSubscription()
- }
-
if (oldVideo && oldVideo.id !== newVideo.id) {
this.peertubeSocket.unsubscribeLiveVideos(oldVideo.id)
}
if (!newVideo.isLive) return
+ if (!this.liveVideosSub) {
+ this.liveVideosSub = this.buildLiveEventsSubscription()
+ }
+
await this.peertubeSocket.subscribeToLiveVideosSocket(newVideo.id)
}