X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fvideos%2Flive-command.ts;h=cc9502c6f1efe9735092dd84b1cece35eba90857;hb=508c1b1e9f3b26752a961e945b7fa59b72b30827;hp=b163f7189e301d50958cc44e434c6777662735f6;hpb=dd84f4f2639cd67b8ff8c04423c59667d55180bf;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/videos/live-command.ts b/shared/server-commands/videos/live-command.ts index b163f7189..cc9502c6f 100644 --- a/shared/server-commands/videos/live-command.ts +++ b/shared/server-commands/videos/live-command.ts @@ -12,6 +12,7 @@ import { ResultList, VideoCreateResult, VideoDetails, + VideoPrivacy, VideoState } from '@shared/models' import { unwrapBody } from '../requests' @@ -115,6 +116,31 @@ export class LiveCommand extends AbstractCommand { return body.video } + async quickCreate (options: OverrideCommandOptions & { + saveReplay: boolean + permanentLive: boolean + privacy?: VideoPrivacy + }) { + const { saveReplay, permanentLive, privacy } = options + + const { uuid } = await this.create({ + ...options, + + fields: { + name: 'live', + permanentLive, + saveReplay, + channelId: this.server.store.channel.id, + privacy + } + }) + + const video = await this.server.videos.getWithToken({ id: uuid }) + const live = await this.get({ videoId: uuid }) + + return { video, live } + } + // --------------------------------------------------------------------------- async sendRTMPStreamInVideo (options: OverrideCommandOptions & { @@ -171,7 +197,7 @@ export class LiveCommand extends AbstractCommand { const segmentName = `${playlistNumber}-00000${segment}.ts` const baseUrl = objectStorage - ? ObjectStorageCommand.getPlaylistBaseUrl() + 'hls' + ? ObjectStorageCommand.getMockPlaylistBaseUrl() + 'hls' : server.url + '/static/streaming-playlists/hls' let error = true @@ -227,7 +253,7 @@ export class LiveCommand extends AbstractCommand { const segmentName = `${playlistNumber}-00000${segment}.ts` const baseUrl = objectStorage - ? ObjectStorageCommand.getPlaylistBaseUrl() + ? ObjectStorageCommand.getMockPlaylistBaseUrl() : `${this.server.url}/static/streaming-playlists/hls` const url = `${baseUrl}/${videoUUID}/${segmentName}` @@ -249,7 +275,7 @@ export class LiveCommand extends AbstractCommand { const { playlistName, videoUUID, objectStorage = false } = options const baseUrl = objectStorage - ? ObjectStorageCommand.getPlaylistBaseUrl() + ? ObjectStorageCommand.getMockPlaylistBaseUrl() : `${this.server.url}/static/streaming-playlists/hls` const url = `${baseUrl}/${videoUUID}/${playlistName}`