From 65cfcb8691aed4c1e0a844930facd5805c57bd31 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Wed, 6 Jul 2022 12:28:00 +0200 Subject: [PATCH] Add RTMPS settings --- src/utils/restreamer.js | 11 ++++-- src/views/Settings.js | 80 ++++++++++++++++++++++++++++------------- 2 files changed, 63 insertions(+), 28 deletions(-) diff --git a/src/utils/restreamer.js b/src/utils/restreamer.js index e337de1..ded7d11 100644 --- a/src/utils/restreamer.js +++ b/src/utils/restreamer.js @@ -677,7 +677,6 @@ class Restreamer { local: 'localhost', app: '', token: '', - name: '', }, srt: { enabled: false, @@ -691,7 +690,6 @@ class Restreamer { host: '', local: 'localhost', credentials: '', - name: '', }, }, }, @@ -824,13 +822,20 @@ class Restreamer { // This is used for FFmpeg to access the RTMP stream. If the RTMP server is bound to a // specific address, we'll use this one, localhost otherwise. - let [rtmp_host, rtmp_port] = splitHostPort(val.config.rtmp.address); + const [rtmp_host, rtmp_port] = splitHostPort(val.config.rtmp.address); config.source.network.rtmp.local = rtmp_host.length !== 0 ? rtmp_host : 'localhost'; if (rtmp_port !== '1935') { config.source.network.rtmp.host += ':' + rtmp_port; config.source.network.rtmp.local += ':' + rtmp_port; } + if (config.source.network.rtmp.secure === true) { + const [, rtmp_port] = splitHostPort(val.config.rtmp.address_tls); + if (rtmp_port !== '1935') { + config.source.network.rtmp.host += ':' + rtmp_port; + } + } + // SRT config.source.network.srt.enabled = val.config.srt.enable; diff --git a/src/views/Settings.js b/src/views/Settings.js index b13c39a..54d7c44 100644 --- a/src/views/Settings.js +++ b/src/views/Settings.js @@ -247,6 +247,18 @@ const configValues = { return null; }, }, + 'rtmp.address_tls': { + tab: 'rtmp', + set: (config, value) => { + config.rtmp.address_tls = value; + }, + unset: (config) => { + delete config.rtmp.address_tls; + }, + validate: (config) => { + return null; + }, + }, 'rtmp.app': { tab: 'rtmp', set: (config, value) => { @@ -755,6 +767,7 @@ export default function Settings(props) { config.address = config.address.split(':').join(''); config.tls.address = config.tls.address.split(':').join(''); config.rtmp.address = config.rtmp.address.split(':').join(''); + config.rtmp.address_tls = config.rtmp.address_tls.split(':').join(''); config.srt.address = config.srt.address.split(':').join(''); if (config.tls.auto === true) { @@ -910,6 +923,7 @@ export default function Settings(props) { config.address = ':' + config.address; config.tls.address = ':' + config.tls.address; config.rtmp.address = ':' + config.rtmp.address; + config.rtmp.address_tls = ':' + config.rtmp.address_tls; config.srt.address = ':' + config.srt.address; if (config.tls.auto === true) { @@ -1821,33 +1835,8 @@ export default function Settings(props) { onChange={handleChange('rtmp.enable')} />{' '} {env('rtmp.enable') && } - RTMPS server} - checked={config.rtmp.enable_tls} - disabled={env('rtmp.enable_tls') || config.rtmp.enable} - onChange={handleChange('rtmp.enable_tls')} - />{' '} - {env('rtmp.enable_tls') && } - - {config.rtmp.enable_tls && ( - - - Requires activation{' '} - { - setTab('auth'); - }} - > - TLS/HTTPS - - . - - - )} @@ -1890,6 +1879,47 @@ export default function Settings(props) { RTMP token for publishing and playing. The token is the value of the URL query parameter 'token.' + + + + + RTMPS server} + checked={config.rtmp.enable_tls} + disabled={env('rtmp.enable_tls')} + onChange={handleChange('rtmp.enable_tls')} + />{' '} + {env('rtmp.enable_tls') && } + + {config.rtmp.enable_tls && !config.tls.auto && ( + + Requires activation{' '} + { + setTab('auth'); + }} + > + TLS/HTTPS + + . + + )} + + + Port} + env={env('rtmp.address_tls')} + disabled={env('rtmp.address_tls') || (!config.rtmp.enable && !config.rtmp.enable_tls)} + value={config.rtmp.address_tls} + onChange={handleChange('rtmp.address_tls')} + /> + + + RTMPS server listen address. + +