X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-live.ts;h=e3fdcc0babb4510de907393d9ff19a844c0e06e9;hb=84845992947365412733d056b9a9fe6ff15bd53f;hp=014491d50011f532de056c2e79e022d1276ce33c;hpb=5b1a6d45b5d6e50102e1c7c8c845401b76b11b4d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index 014491d50..e3fdcc0ba 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts @@ -1,10 +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/core-utils' +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: [ @@ -97,11 +98,18 @@ 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 { - // If we don't have a stream key, it means this is a remote live so we don't specify the rtmp URL - rtmpUrl: this.streamKey - ? WEBSERVER.RTMP_URL - : null, + rtmpUrl, + rtmpsUrl, streamKey: this.streamKey, permanentLive: this.permanentLive,