From cfbe6be516808de4b45ca9d98f912999ef8daaab Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 2 May 2022 14:32:12 +0200 Subject: Add ability to provide rtmp listening hostname --- server/initializers/config.ts | 4 +++- server/initializers/constants.ts | 7 +++++-- server/lib/live/live-manager.ts | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/initializers/config.ts b/server/initializers/config.ts index d8f5f3496..59a65d6a5 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -313,13 +313,15 @@ const CONFIG = { RTMP: { get ENABLED () { return config.get('live.rtmp.enabled') }, get PORT () { return config.get('live.rtmp.port') }, - get HOSTNAME () { return config.get('live.rtmp.hostname') } + get HOSTNAME () { return config.get('live.rtmp.hostname') }, + get PUBLIC_HOSTNAME () { return config.get('live.rtmp.public_hostname') } }, RTMPS: { get ENABLED () { return config.get('live.rtmps.enabled') }, get PORT () { return config.get('live.rtmps.port') }, get HOSTNAME () { return config.get('live.rtmps.hostname') }, + get PUBLIC_HOSTNAME () { return config.get('live.rtmps.public_hostname') }, get KEY_FILE () { return config.get('live.rtmps.key_file') }, get CERT_FILE () { return config.get('live.rtmps.cert_file') } }, diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 4656ccdbc..9986dbf89 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -1074,8 +1074,11 @@ function updateWebserverUrls () { WEBSERVER.HOSTNAME = CONFIG.WEBSERVER.HOSTNAME WEBSERVER.PORT = CONFIG.WEBSERVER.PORT - WEBSERVER.RTMP_URL = 'rtmp://' + CONFIG.LIVE.RTMP.HOSTNAME + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH - WEBSERVER.RTMPS_URL = 'rtmps://' + CONFIG.LIVE.RTMPS.HOSTNAME + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH + const rtmpHostname = CONFIG.LIVE.RTMP.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME + const rtmpsHostname = CONFIG.LIVE.RTMPS.PUBLIC_HOSTNAME || CONFIG.WEBSERVER.HOSTNAME + + WEBSERVER.RTMP_URL = 'rtmp://' + rtmpHostname + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH + WEBSERVER.RTMPS_URL = 'rtmps://' + rtmpsHostname + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH } function updateWebserverConfig () { diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts index 5ffe41ee3..da09aa05c 100644 --- a/server/lib/live/live-manager.ts +++ b/server/lib/live/live-manager.ts @@ -118,7 +118,7 @@ class LiveManager { logger.error('Cannot run RTMP server.', { err, ...lTags() }) }) - this.rtmpServer.listen(CONFIG.LIVE.RTMP.PORT) + this.rtmpServer.listen(CONFIG.LIVE.RTMP.PORT, CONFIG.LIVE.RTMP.HOSTNAME) } if (CONFIG.LIVE.RTMPS.ENABLED) { @@ -141,7 +141,7 @@ class LiveManager { logger.error('Cannot run RTMPS server.', { err, ...lTags() }) }) - this.rtmpsServer.listen(CONFIG.LIVE.RTMPS.PORT) + this.rtmpsServer.listen(CONFIG.LIVE.RTMPS.PORT, CONFIG.LIVE.RTMPS.HOSTNAME) } } -- cgit v1.2.3