diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-04 13:40:02 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-03-09 09:23:10 +0100 |
commit | f443a74649174b2f9347c158e30f8ac7aa3e958a (patch) | |
tree | e423bc4e2307477bda4341037b7fa04ad10adae6 /server/controllers | |
parent | 01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff) | |
download | PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip |
Add latency setting support
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/api/config.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/live.ts | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 821ed4ad3..376143cb8 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -237,6 +237,9 @@ function customConfig (): CustomConfig { | |||
237 | live: { | 237 | live: { |
238 | enabled: CONFIG.LIVE.ENABLED, | 238 | enabled: CONFIG.LIVE.ENABLED, |
239 | allowReplay: CONFIG.LIVE.ALLOW_REPLAY, | 239 | allowReplay: CONFIG.LIVE.ALLOW_REPLAY, |
240 | latencySetting: { | ||
241 | enabled: CONFIG.LIVE.LATENCY_SETTING.ENABLED | ||
242 | }, | ||
240 | maxDuration: CONFIG.LIVE.MAX_DURATION, | 243 | maxDuration: CONFIG.LIVE.MAX_DURATION, |
241 | maxInstanceLives: CONFIG.LIVE.MAX_INSTANCE_LIVES, | 244 | maxInstanceLives: CONFIG.LIVE.MAX_INSTANCE_LIVES, |
242 | maxUserLives: CONFIG.LIVE.MAX_USER_LIVES, | 245 | maxUserLives: CONFIG.LIVE.MAX_USER_LIVES, |
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 49cabb6f3..c6f038079 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { exists } from '@server/helpers/custom-validators/misc' | ||
2 | import { createReqFiles } from '@server/helpers/express-utils' | 3 | import { createReqFiles } from '@server/helpers/express-utils' |
3 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' | 4 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' |
4 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 5 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
@@ -9,7 +10,7 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator | |||
9 | import { VideoLiveModel } from '@server/models/video/video-live' | 10 | import { VideoLiveModel } from '@server/models/video/video-live' |
10 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | 11 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' |
11 | import { buildUUID, uuidToShort } from '@shared/extra-utils' | 12 | import { buildUUID, uuidToShort } from '@shared/extra-utils' |
12 | import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' | 13 | import { HttpStatusCode, LiveVideoCreate, LiveVideoLatencyMode, LiveVideoUpdate, VideoState } from '@shared/models' |
13 | import { logger } from '../../../helpers/logger' | 14 | import { logger } from '../../../helpers/logger' |
14 | import { sequelizeTypescript } from '../../../initializers/database' | 15 | import { sequelizeTypescript } from '../../../initializers/database' |
15 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' | 16 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
@@ -60,8 +61,9 @@ async function updateLiveVideo (req: express.Request, res: express.Response) { | |||
60 | const video = res.locals.videoAll | 61 | const video = res.locals.videoAll |
61 | const videoLive = res.locals.videoLive | 62 | const videoLive = res.locals.videoLive |
62 | 63 | ||
63 | videoLive.saveReplay = body.saveReplay || false | 64 | if (exists(body.saveReplay)) videoLive.saveReplay = body.saveReplay |
64 | videoLive.permanentLive = body.permanentLive || false | 65 | if (exists(body.permanentLive)) videoLive.permanentLive = body.permanentLive |
66 | if (exists(body.latencyMode)) videoLive.latencyMode = body.latencyMode | ||
65 | 67 | ||
66 | video.VideoLive = await videoLive.save() | 68 | video.VideoLive = await videoLive.save() |
67 | 69 | ||
@@ -87,6 +89,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { | |||
87 | const videoLive = new VideoLiveModel() | 89 | const videoLive = new VideoLiveModel() |
88 | videoLive.saveReplay = videoInfo.saveReplay || false | 90 | videoLive.saveReplay = videoInfo.saveReplay || false |
89 | videoLive.permanentLive = videoInfo.permanentLive || false | 91 | videoLive.permanentLive = videoInfo.permanentLive || false |
92 | videoLive.latencyMode = videoInfo.latencyMode || LiveVideoLatencyMode.DEFAULT | ||
90 | videoLive.streamKey = buildUUID() | 93 | videoLive.streamKey = buildUUID() |
91 | 94 | ||
92 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ | 95 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ |