mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00

* Add Scheduled Lives functionality through originallyPublishedAt Implements #6604 by reusing the originallyPublishedAt field of isLive videos to mark "waiting for live" videos as scheduled at a set time. * Hide scheduled lives from Browse Videos page * Add tests for Scheduled Live videos * Make scheduled lives use a dedicated scheduledAt field in the VideoLive table * Plan live schedules to evolve in the future * Use a dedicated table to store live schedules, so we can add multiple schedules in the future and also add a title, description etc. for a specific schedule * Adapt REST API to use an array to store/get live schedules * Add REST API param so it's the client choice to include or not scheduled lives * Export schedules info in user import/export --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
18 lines
596 B
TypeScript
18 lines
596 B
TypeScript
import { LiveVideoLatencyMode } from '@peertube/peertube-models'
|
|
import { isDateValid } from './misc.js'
|
|
|
|
export function isLiveLatencyModeValid (value: any) {
|
|
return [ LiveVideoLatencyMode.DEFAULT, LiveVideoLatencyMode.SMALL_LATENCY, LiveVideoLatencyMode.HIGH_LATENCY ].includes(value)
|
|
}
|
|
|
|
export function isLiveScheduleValid (schedule: any) {
|
|
return isDateValid(schedule?.startAt)
|
|
}
|
|
|
|
export function areLiveSchedulesValid (schedules: any[]) {
|
|
if (!schedules) return true
|
|
|
|
if (!Array.isArray(schedules)) return false
|
|
|
|
return schedules.every(schedule => isLiveScheduleValid(schedule))
|
|
}
|