X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-live.ts;h=e3fdcc0babb4510de907393d9ff19a844c0e06e9;hb=c3edc5b074aa4bb1861ed0a94d3713808e87170f;hp=a1dd80d3c74bfe0d9cb6e5ce12f221ed2ad707e7;hpb=fb7194043d0486ce0a6a40b2ffbdf32878c33a6f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index a1dd80d3c..e3fdcc0ba 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts @@ -1,9 +1,11 @@ import { AllowNull, BelongsTo, Column, CreatedAt, DataType, DefaultScope, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' import { WEBSERVER } from '@server/initializers/constants' import { MVideoLive, MVideoLiveVideo } from '@server/types/models' +import { AttributesOnly } from '@shared/typescript-utils' import { LiveVideo, VideoState } from '@shared/models' import { VideoModel } from './video' import { VideoBlacklistModel } from './video-blacklist' +import { CONFIG } from '@server/initializers/config' @DefaultScope(() => ({ include: [ @@ -28,7 +30,7 @@ import { VideoBlacklistModel } from './video-blacklist' } ] }) -export class VideoLiveModel extends Model { +export class VideoLiveModel extends Model>> { @AllowNull(true) @Column(DataType.STRING) @@ -36,11 +38,11 @@ export class VideoLiveModel extends Model { @AllowNull(false) @Column - perpetualLive: boolean + saveReplay: boolean @AllowNull(false) @Column - saveReplay: boolean + permanentLive: boolean @CreatedAt createdAt: Date @@ -96,9 +98,22 @@ export class VideoLiveModel extends Model { } toFormattedJSON (): LiveVideo { + let rtmpUrl: string = null + let rtmpsUrl: string = null + + // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL + if (this.streamKey) { + if (CONFIG.LIVE.RTMP.ENABLED) rtmpUrl = WEBSERVER.RTMP_URL + if (CONFIG.LIVE.RTMPS.ENABLED) rtmpsUrl = WEBSERVER.RTMPS_URL + } + return { - rtmpUrl: WEBSERVER.RTMP_URL, - streamKey: this.streamKey + rtmpUrl, + rtmpsUrl, + + streamKey: this.streamKey, + permanentLive: this.permanentLive, + saveReplay: this.saveReplay } } }