mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Add Scheduled Lives functionality (#7144)
* 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>
This commit is contained in:
parent
a5c087d3d4
commit
8c9b4abe45
62 changed files with 858 additions and 148 deletions
|
@ -17,6 +17,7 @@ import { CONFIG } from '@server/initializers/config.js'
|
|||
import { sequelizeTypescript } from '@server/initializers/database.js'
|
||||
import { ScheduleVideoUpdateModel } from '@server/models/video/schedule-video-update.js'
|
||||
import { VideoLiveReplaySettingModel } from '@server/models/video/video-live-replay-setting.js'
|
||||
import { VideoLiveScheduleModel } from '@server/models/video/video-live-schedule.js'
|
||||
import { VideoLiveModel } from '@server/models/video/video-live.js'
|
||||
import { VideoPasswordModel } from '@server/models/video/video-password.js'
|
||||
import { VideoModel } from '@server/models/video/video.js'
|
||||
|
@ -44,7 +45,7 @@ type VideoAttributes = Omit<VideoCreate, 'channelId'> & {
|
|||
inputFilename: string
|
||||
}
|
||||
|
||||
type LiveAttributes = Pick<LiveVideoCreate, 'permanentLive' | 'latencyMode' | 'saveReplay' | 'replaySettings'> & {
|
||||
type LiveAttributes = Pick<LiveVideoCreate, 'permanentLive' | 'latencyMode' | 'saveReplay' | 'replaySettings' | 'schedules'> & {
|
||||
streamKey?: string
|
||||
}
|
||||
|
||||
|
@ -203,6 +204,14 @@ export class LocalVideoCreator {
|
|||
|
||||
videoLive.videoId = this.video.id
|
||||
this.video.VideoLive = await videoLive.save({ transaction })
|
||||
|
||||
if (this.liveAttributes.schedules) {
|
||||
this.video.VideoLive.LiveSchedules = await VideoLiveScheduleModel.addToLiveId(
|
||||
this.video.VideoLive.id,
|
||||
this.liveAttributes.schedules.map(s => s.startAt),
|
||||
transaction
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (this.videoFile) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue