mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Add latency setting support
This commit is contained in:
parent
01dd04cd5a
commit
f443a74649
42 changed files with 516 additions and 81 deletions
|
@ -1,10 +1,11 @@
|
|||
import validator from 'validator'
|
||||
import { logger } from '@server/helpers/logger'
|
||||
import { ActivityTrackerUrlObject, ActivityVideoFileMetadataUrlObject } from '@shared/models'
|
||||
import { VideoState } from '../../../../shared/models/videos'
|
||||
import { LiveVideoLatencyMode, VideoState } from '../../../../shared/models/videos'
|
||||
import { ACTIVITY_PUB, CONSTRAINTS_FIELDS } from '../../../initializers/constants'
|
||||
import { peertubeTruncate } from '../../core-utils'
|
||||
import { exists, isArray, isBooleanValid, isDateValid, isUUIDValid } from '../misc'
|
||||
import { isLiveLatencyModeValid } from '../video-lives'
|
||||
import {
|
||||
isVideoDurationValid,
|
||||
isVideoNameValid,
|
||||
|
@ -65,6 +66,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) {
|
|||
if (!isBooleanValid(video.isLiveBroadcast)) video.isLiveBroadcast = false
|
||||
if (!isBooleanValid(video.liveSaveReplay)) video.liveSaveReplay = false
|
||||
if (!isBooleanValid(video.permanentLive)) video.permanentLive = false
|
||||
if (!isLiveLatencyModeValid(video.latencyMode)) video.latencyMode = LiveVideoLatencyMode.DEFAULT
|
||||
|
||||
return isActivityPubUrlValid(video.id) &&
|
||||
isVideoNameValid(video.name) &&
|
||||
|
|
11
server/helpers/custom-validators/video-lives.ts
Normal file
11
server/helpers/custom-validators/video-lives.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { LiveVideoLatencyMode } from '@shared/models'
|
||||
|
||||
function isLiveLatencyModeValid (value: any) {
|
||||
return [ LiveVideoLatencyMode.DEFAULT, LiveVideoLatencyMode.SMALL_LATENCY, LiveVideoLatencyMode.HIGH_LATENCY ].includes(value)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
isLiveLatencyModeValid
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue