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/api/videos/live.ts | |
parent | 01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff) | |
download | PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip |
Add latency setting support
Diffstat (limited to 'server/controllers/api/videos/live.ts')
-rw-r--r-- | server/controllers/api/videos/live.ts | 9 |
1 files changed, 6 insertions, 3 deletions
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({ |