mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Fix fast restream in saved permanent live
This commit is contained in:
parent
50341c8fe9
commit
53023be33a
9 changed files with 182 additions and 65 deletions
|
@ -39,15 +39,18 @@ export class ConfigCommand extends AbstractCommand {
|
|||
enableLive (options: {
|
||||
allowReplay?: boolean
|
||||
transcoding?: boolean
|
||||
resolutions?: 'min' | 'max' // Default max
|
||||
} = {}) {
|
||||
const { allowReplay, transcoding, resolutions = 'max' } = options
|
||||
|
||||
return this.updateExistingSubConfig({
|
||||
newConfig: {
|
||||
live: {
|
||||
enabled: true,
|
||||
allowReplay: options.allowReplay ?? true,
|
||||
allowReplay: allowReplay ?? true,
|
||||
transcoding: {
|
||||
enabled: options.transcoding ?? true,
|
||||
resolutions: ConfigCommand.getCustomConfigResolutions(true)
|
||||
enabled: transcoding ?? true,
|
||||
resolutions: ConfigCommand.getCustomConfigResolutions(resolutions === 'max')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,13 +154,33 @@ export class LiveCommand extends AbstractCommand {
|
|||
|
||||
waitUntilSegmentGeneration (options: OverrideCommandOptions & {
|
||||
videoUUID: string
|
||||
resolution: number
|
||||
playlistNumber: number
|
||||
segment: number
|
||||
totalSessions?: number
|
||||
}) {
|
||||
const { playlistNumber, segment, videoUUID, totalSessions = 1 } = options
|
||||
const segmentName = `${playlistNumber}-00000${segment}.ts`
|
||||
|
||||
return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, totalSessions * 2, false)
|
||||
}
|
||||
|
||||
getSegment (options: OverrideCommandOptions & {
|
||||
videoUUID: string
|
||||
playlistNumber: number
|
||||
segment: number
|
||||
}) {
|
||||
const { resolution, segment, videoUUID } = options
|
||||
const segmentName = `${resolution}-00000${segment}.ts`
|
||||
const { playlistNumber, segment, videoUUID } = options
|
||||
|
||||
return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false)
|
||||
const segmentName = `${playlistNumber}-00000${segment}.ts`
|
||||
const url = `${this.server.url}/static/streaming-playlists/hls/${videoUUID}/${segmentName}`
|
||||
|
||||
return this.getRawRequest({
|
||||
...options,
|
||||
|
||||
url,
|
||||
implicitToken: false,
|
||||
defaultExpectedStatus: HttpStatusCode.OK_200
|
||||
})
|
||||
}
|
||||
|
||||
async waitUntilReplacedByReplay (options: OverrideCommandOptions & {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue