Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/datarhei/restreamer-ui into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jstabenow committed Jan 26, 2024
2 parents e92f875 + 53e8096 commit 80c01f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
4 changes: 1 addition & 3 deletions src/utils/restreamer.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,9 +922,7 @@ class Restreamer {
ConfigActive() {
const config = JSON.parse(JSON.stringify(this.config));

config.source.network.rtmp.name = this.channel.channelid;
config.source.network.hls.name = this.channel.channelid;
config.source.network.srt.name = this.channel.channelid;
config.source.network.channelid = this.channel.channelid;

return config;
}
Expand Down
34 changes: 16 additions & 18 deletions src/views/Edit/Sources/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const useStyles = makeStyles((theme) => ({
},
}));

const initSettings = (initialSettings) => {
const initSettings = (initialSettings, config) => {
if (!initialSettings) {
initialSettings = {};
}
Expand All @@ -54,7 +54,7 @@ const initSettings = (initialSettings) => {

settings.push = {
type: 'rtmp',
name: 'none',
name: config.channelid,
...settings.push,
};

Expand Down Expand Up @@ -101,6 +101,7 @@ const initConfig = (initialConfig) => {
rtmp: {},
srt: {},
hls: {},
channelid: 'external',
...initialConfig,
};

Expand All @@ -111,7 +112,6 @@ const initConfig = (initialConfig) => {
local: 'localhost',
app: '',
token: '',
name: 'external',
...config.rtmp,
};

Expand All @@ -121,7 +121,6 @@ const initConfig = (initialConfig) => {
local: 'localhost',
token: '',
passphrase: '',
name: 'external',
...config.srt,
};

Expand All @@ -130,7 +129,6 @@ const initConfig = (initialConfig) => {
host: 'localhost',
local: 'localhost',
credentials: '',
name: 'external',
...config.hls,
};

Expand Down Expand Up @@ -198,16 +196,16 @@ const createInputs = (settings, config, skills) => {
let name = settings.push.name;
if (settings.push.type === 'hls') {
if (name === 'none') {
name = config.hls.name;
name = config.channelid;
}
input.address = getLocalHLS(name);
} else if (settings.push.type === 'rtmp') {
if (name === config.rtmp.name) {
if (name === config.channelid) {
name += '.stream';
}
input.address = getLocalRTMP(name);
} else if (settings.push.type === 'srt') {
if (name === config.srt.name) {
if (name === config.channelid) {
name += '.stream';
}
input.address = getLocalSRT(name);
Expand Down Expand Up @@ -452,25 +450,25 @@ const getSRTAddress = (host, name, token, passphrase, publish) => {
};

const getHLS = (config, name) => {
const url = getHLSAddress(config.hls.host, config.hls.credentials, config.hls.name, config.hls.secure);
const url = getHLSAddress(config.hls.host, config.hls.credentials, config.channelid, config.hls.secure);

return url;
};

const getRTMP = (config) => {
const url = getRTMPAddress(config.rtmp.host, config.rtmp.app, config.rtmp.name, config.rtmp.token, config.rtmp.secure);
const url = getRTMPAddress(config.rtmp.host, config.rtmp.app, config.channelid, config.rtmp.token, config.rtmp.secure);

return url;
};

const getSRT = (config) => {
const url = getSRTAddress(config.srt.host, config.srt.name, config.srt.token, config.srt.passphrase, true);
const url = getSRTAddress(config.srt.host, config.channelid, config.srt.token, config.srt.passphrase, true);

return url;
};

const getLocalHLS = (config, name) => {
let url = getHLSAddress(config.hls.local, '', config.hls.name, false);
let url = getHLSAddress(config.hls.local, '', config.channelid, false);

return url;
};
Expand Down Expand Up @@ -936,7 +934,7 @@ function PushRTMP(props) {
);

options.push(
<MenuItem key={config.rtmp.name} value={config.rtmp.name}>
<MenuItem key={config.channelid} value={config.channelid}>
{i18n._(t`Send stream to address ...`)}
</MenuItem>,
);
Expand All @@ -951,7 +949,7 @@ function PushRTMP(props) {
<Trans>Refresh</Trans>
</Button>
</Grid>
{props.settings.push.name === config.rtmp.name && (
{props.settings.push.name === config.channelid && (
<React.Fragment>
<Grid item xs={12}>
<Typography>
Expand Down Expand Up @@ -1030,7 +1028,7 @@ function PushSRT(props) {
);

options.push(
<MenuItem key={config.srt.name} value={config.srt.name}>
<MenuItem key={config.channelid} value={config.channelid}>
{i18n._(t`Send stream to address ...`)}
</MenuItem>,
);
Expand All @@ -1045,7 +1043,7 @@ function PushSRT(props) {
<Trans>Refresh</Trans>
</Button>
</Grid>
{props.settings.push.name === config.srt.name && (
{props.settings.push.name === config.channelid && (
<React.Fragment>
<Grid item xs={12}>
<Typography>
Expand Down Expand Up @@ -1086,7 +1084,7 @@ function Source(props) {
const classes = useStyles();
const { i18n } = useLingui();
const config = initConfig(props.config);
const settings = initSettings(props.settings);
const settings = initSettings(props.settings, config);
const skills = initSkills(props.skills);

const handleChange = (section, what) => (event) => {
Expand All @@ -1113,7 +1111,7 @@ function Source(props) {
} else if (section === 'push') {
settings.push[what] = value;
if (what === 'type') {
settings.push.name = 'none';
settings.push.name = config.channelid;
}
} else {
settings[what] = value;
Expand Down

0 comments on commit 80c01f9

Please sign in to comment.