Add SRT push option
This commit is contained in:
parent
56b64e90da
commit
20809bfc01
@ -837,6 +837,8 @@ class Restreamer {
|
||||
config.source.network.srt.passphrase = val.config.srt.passphrase;
|
||||
config.source.network.srt.token = val.config.srt.token;
|
||||
|
||||
config.source.network.srt.host = config.hostname;
|
||||
|
||||
let [srt_host, srt_port] = splitHostPort(val.config.srt.address);
|
||||
config.source.network.srt.local = srt_host.length !== 0 ? srt_host : 'localhost';
|
||||
config.source.network.srt.host += ':' + srt_port;
|
||||
@ -862,6 +864,7 @@ class Restreamer {
|
||||
|
||||
config.source.network.rtmp.name = this.channel.channelid;
|
||||
config.source.network.hls.name = this.channel.channelid;
|
||||
config.source.network.srt.name = this.channel.channelid;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
98
src/views/Edit/Wizard/Sources/InternalSRT.js
Normal file
98
src/views/Edit/Wizard/Sources/InternalSRT.js
Normal file
@ -0,0 +1,98 @@
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { Trans } from '@lingui/macro';
|
||||
import Button from '@mui/material/Button';
|
||||
import Grid from '@mui/material/Grid';
|
||||
import Icon from '@mui/icons-material/KeyboardTab';
|
||||
import Typography from '@mui/material/Typography';
|
||||
|
||||
import * as S from '../../Sources/Network';
|
||||
import BoxTextarea from '../../../../misc/BoxTextarea';
|
||||
import Textarea from '../../../../misc/Textarea';
|
||||
|
||||
const initSettings = (initialSettings) => {
|
||||
const settings = {
|
||||
...S.func.initSettings(initialSettings),
|
||||
mode: 'push',
|
||||
};
|
||||
|
||||
settings.push.type = 'srt';
|
||||
|
||||
return settings;
|
||||
};
|
||||
|
||||
function Source(props) {
|
||||
const navigate = useNavigate();
|
||||
const settings = initSettings(props.settings);
|
||||
const config = S.func.initConfig(props.config);
|
||||
const skills = S.func.initSkills(props.skills);
|
||||
|
||||
const handleChange = (newSettings) => {
|
||||
newSettings = newSettings || settings;
|
||||
|
||||
const inputs = S.func.createInputs(newSettings, config, skills);
|
||||
newSettings.address = inputs[0].address;
|
||||
|
||||
props.onChange(S.id, newSettings, inputs, config.rtmp.enabled);
|
||||
};
|
||||
|
||||
React.useEffect(() => {
|
||||
handleChange();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
if (config.srt.enabled === false) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Grid item xs={12}>
|
||||
<Typography>
|
||||
<Trans>SRT server is not enabled</Trans>
|
||||
</Typography>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<Button variant="outlined" size="large" fullWidth color="primary" onClick={() => navigate('/settings/srt')}>
|
||||
<Trans>Enable SRT server ...</Trans>
|
||||
</Button>
|
||||
</Grid>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
const SRTs = S.func.getSRT(config, settings.push.name);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Grid item xs={12}>
|
||||
<Typography>
|
||||
<Trans>Send stream to this address:</Trans>
|
||||
</Typography>
|
||||
</Grid>
|
||||
{SRTs.length !== 0 && (
|
||||
<Grid item xs={12}>
|
||||
<BoxTextarea>
|
||||
<Textarea rows={SRTs.length} value={SRTs.join('\n')} readOnly allowCopy />
|
||||
</BoxTextarea>
|
||||
</Grid>
|
||||
)}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
Source.defaultProps = {
|
||||
settings: {},
|
||||
config: null,
|
||||
skills: null,
|
||||
onChange: function (type, settings, inputs, ready) {},
|
||||
};
|
||||
|
||||
function SourceIcon(props) {
|
||||
return <Icon style={{ color: '#FFF' }} {...props} />;
|
||||
}
|
||||
|
||||
const id = 'srt';
|
||||
const type = 'network';
|
||||
const name = <Trans>Internal SRT server</Trans>;
|
||||
const capabilities = ['audio', 'video'];
|
||||
|
||||
export { id, type, name, capabilities, SourceIcon as icon, Source as component };
|
||||
@ -1,5 +1,6 @@
|
||||
import * as AVFoundation from './AVFoundation';
|
||||
import * as InternalRTMP from './InternalRTMP';
|
||||
import * as InternalSRT from './InternalSRT';
|
||||
import * as Network from './Network';
|
||||
import * as Raspicam from './Raspicam';
|
||||
import * as V4L from './V4L';
|
||||
@ -35,6 +36,7 @@ const registry = new Registry();
|
||||
|
||||
registry.Register(Network);
|
||||
registry.Register(InternalRTMP);
|
||||
registry.Register(InternalSRT);
|
||||
//registry.Register(InternalHLS);
|
||||
registry.Register(AVFoundation);
|
||||
registry.Register(Raspicam);
|
||||
|
||||
@ -227,7 +227,16 @@ export default function Wizard(props) {
|
||||
let knownSources = [];
|
||||
for (let s in $skills.sources) {
|
||||
if (s === 'network') {
|
||||
knownSources.push('network', 'rtmp', 'hls');
|
||||
knownSources.push('network');
|
||||
if ($skills.protocols.input.includes('rtmp')) {
|
||||
knownSources.push('rtmp');
|
||||
}
|
||||
if ($skills.protocols.input.includes('http')) {
|
||||
knownSources.push('hls');
|
||||
}
|
||||
if ($skills.protocols.input.includes('srt')) {
|
||||
knownSources.push('srt');
|
||||
}
|
||||
} else if (s === 'video4linux2') {
|
||||
knownSources.push('video4linux2');
|
||||
} else if (s === 'raspicam') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user