aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos.ts9
-rw-r--r--server/lib/job-queue/handlers/video-live-ending.ts2
-rw-r--r--server/lib/live-manager.ts2
-rw-r--r--server/lib/peertube-socket.ts13
4 files changed, 22 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index cb462e258..8545e5bad 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -461,8 +461,13 @@ async function updateVideoFromAP (options: {
461 transaction: undefined 461 transaction: undefined
462 }) 462 })
463 463
464 if (wasPrivateVideo || wasUnlistedVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoUpdated) // Notify our users? 464 // Notify our users?
465 if (videoUpdated.isLive) PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated) 465 if (wasPrivateVideo || wasUnlistedVideo) Notifier.Instance.notifyOnNewVideoIfNeeded(videoUpdated)
466
467 if (videoUpdated.isLive) {
468 PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated)
469 PeerTubeSocket.Instance.sendVideoViewsUpdate(videoUpdated)
470 }
466 471
467 logger.info('Remote video with uuid %s updated', videoObject.uuid) 472 logger.info('Remote video with uuid %s updated', videoObject.uuid)
468 473
diff --git a/server/lib/job-queue/handlers/video-live-ending.ts b/server/lib/job-queue/handlers/video-live-ending.ts
index 93d925830..8018e2277 100644
--- a/server/lib/job-queue/handlers/video-live-ending.ts
+++ b/server/lib/job-queue/handlers/video-live-ending.ts
@@ -91,7 +91,7 @@ async function saveLive (video: MVideo, live: MVideoLive) {
91 await VideoFileModel.removeHLSFilesOfVideoId(hlsPlaylist.id) 91 await VideoFileModel.removeHLSFilesOfVideoId(hlsPlaylist.id)
92 hlsPlaylist.VideoFiles = [] 92 hlsPlaylist.VideoFiles = []
93 93
94 let durationDone: boolean 94 let durationDone = false
95 95
96 for (const playlistFile of playlistFiles) { 96 for (const playlistFile of playlistFiles) {
97 const concatenatedTsFile = LiveManager.Instance.buildConcatenatedName(playlistFile) 97 const concatenatedTsFile = LiveManager.Instance.buildConcatenatedName(playlistFile)
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index 5d9b68756..2fb4b774c 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -537,6 +537,8 @@ class LiveManager {
537 537
538 await federateVideoIfNeeded(video, false) 538 await federateVideoIfNeeded(video, false)
539 539
540 PeerTubeSocket.Instance.sendVideoViewsUpdate(video)
541
540 // Only keep not expired watchers 542 // Only keep not expired watchers
541 const newWatchers = watchers.filter(w => w > notBefore) 543 const newWatchers = watchers.filter(w => w > notBefore)
542 this.watchersPerVideo.set(videoId, newWatchers) 544 this.watchersPerVideo.set(videoId, newWatchers)
diff --git a/server/lib/peertube-socket.ts b/server/lib/peertube-socket.ts
index 5fc5bc20b..e27963e60 100644
--- a/server/lib/peertube-socket.ts
+++ b/server/lib/peertube-socket.ts
@@ -69,7 +69,18 @@ class PeerTubeSocket {
69 const data: LiveVideoEventPayload = { state: video.state } 69 const data: LiveVideoEventPayload = { state: video.state }
70 const type: LiveVideoEventType = 'state-change' 70 const type: LiveVideoEventType = 'state-change'
71 71
72 logger.debug('Sending video live new state notification of %s.', video.url) 72 logger.debug('Sending video live new state notification of %s.', video.url, { state: video.state })
73
74 this.liveVideosNamespace
75 .in(video.id)
76 .emit(type, data)
77 }
78
79 sendVideoViewsUpdate (video: MVideo) {
80 const data: LiveVideoEventPayload = { views: video.views }
81 const type: LiveVideoEventType = 'views-change'
82
83 logger.debug('Sending video live views update notification of %s.', video.url, { views: video.views })
73 84
74 this.liveVideosNamespace 85 this.liveVideosNamespace
75 .in(video.id) 86 .in(video.id)