From a5cf76afa378aae81af2a9b0ce548e5d2582f832 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Sep 2020 10:04:21 +0200 Subject: Add watch messages if live has not started --- server/models/video/video.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'server/models/video/video.ts') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index a3e3b6cfe..8493ab802 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -127,6 +127,7 @@ import { VideoShareModel } from './video-share' import { VideoStreamingPlaylistModel } from './video-streaming-playlist' import { VideoTagModel } from './video-tag' import { VideoViewModel } from './video-view' +import { LiveManager } from '@server/lib/live-manager' export enum ScopeNames { AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS', @@ -799,6 +800,13 @@ export class VideoModel extends Model { return undefined } + @BeforeDestroy + static stopLiveIfNeeded (instance: VideoModel) { + if (!instance.isLive) return + + return LiveManager.Instance.stopSessionOf(instance.id) + } + @BeforeDestroy static invalidateCache (instance: VideoModel) { ModelCache.Instance.invalidateCache('video', instance.id) -- cgit v1.2.3