Skip to content

Commit

Permalink
Add Telegram and Owncast to publication services - datarhei/restreame…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstabenow committed Jun 21, 2022
1 parent a70f683 commit fbe9d91
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Restreamer-UI

#### v1.1.0 > v1.3.1

- Add Owncast to publication services
- Add Telegram to publication services
- Fix VAAPI encoder

#### v1.0.0 > v1.1.0

- Add compatibility list for encoders
Expand Down
113 changes: 113 additions & 0 deletions src/views/Publication/Services/Owncast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import React from 'react';

import { Trans } from '@lingui/macro';
import Grid from '@mui/material/Grid';
import Link from '@mui/material/Link';
import TextField from '@mui/material/TextField';

import Logo from './logos/owncast.svg';

const id = 'owncast';
const name = 'Owncast';
const version = '1.0';
const stream_key_link = '';
const description = (
<Trans>
Transmit your Livestream to an Owncast server.{' '}
<Link color="secondary" target="_blank" href="https://owncast.online/quickstart/startstreaming/">
Here {' '}
</Link>
you can find more details about the settings.
</Trans>
);
const image_copyright = <Trans>Please get in touch with the operator of the service and check what happens.</Trans>;
const author = {
creator: {
name: 'datarhei',
link: 'https://github.com/datarhei',
},
maintainer: {
name: 'datarhei',
link: 'https://github.com/datarhei',
},
};
const category = 'software';
const requires = {
protocols: ['rtmps'],
formats: ['flv'],
codecs: {
audio: ['aac', 'mp3'],
video: ['h264'],
},
};

function ServiceIcon(props) {
return <img src={Logo} alt="Telegram Logo" {...props} />;
}

function init(settings) {
const initSettings = {
protocol: 'rtmp://',
server_url: '',
stream_key: '',
...settings,
};

return initSettings;
}

function Service(props) {
const settings = init(props.settings);

const handleChange = (what) => (event) => {
const value = event.target.value;

settings[what] = value;

const output = createOutput(settings);

props.onChange([output], settings);
};

const createOutput = (settings) => {
const output = {
address: settings.protocol + settings.server_url + '/' + settings.stream_key,
options: ['-f', 'flv'],
};

return output;
};

return (
<Grid container spacing={2}>
<Grid item xs={12} md={3}>
<TextField
variant="outlined"
fullWidth
type="url"
label={<Trans>Protocol</Trans>}
value={settings.protocol}
onChange={handleChange('protocol')}
readOnly
disabled
/>
</Grid>
<Grid item xs={12} md={9}>
<TextField variant="outlined" fullWidth placeholder="yourserver/live" label={<Trans>Server URL</Trans>} value={settings.server_url} onChange={handleChange('server_url')} />
</Grid>
<Grid item xs={12}>
<TextField variant="outlined" fullWidth placeholder="abc123" label={<Trans>Stream Key</Trans>} value={settings.stream_key} onChange={handleChange('stream_key')} />
</Grid>
</Grid>
);
}

Service.defaultProps = {
settings: {},
skills: {},
metadata: {},
streams: [],
onChange: function (output, settings) {},
};

export { id, name, version, stream_key_link, description, image_copyright, author, category, requires, ServiceIcon as icon, Service as component };
108 changes: 108 additions & 0 deletions src/views/Publication/Services/Telegram.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from 'react';

import { Trans } from '@lingui/macro';
import Grid from '@mui/material/Grid';
import TextField from '@mui/material/TextField';

import Logo from './logos/telegram.svg';

const id = 'telegram';
const name = 'Telegram';
const version = '1.0';
const stream_key_link = '';
const description = (
<Trans>
Transmit a Livestream to a Telegram Channel.
</Trans>
);
const image_copyright = <Trans>Please get in touch with the operator of the service and check what happens.</Trans>;
const author = {
creator: {
name: 'datarhei',
link: 'https://github.com/datarhei',
},
maintainer: {
name: 'datarhei',
link: 'https://github.com/datarhei',
},
};
const category = 'platform';
const requires = {
protocols: ['rtmps'],
formats: ['flv'],
codecs: {
audio: ['aac', 'mp3'],
video: ['h264'],
},
};

function ServiceIcon(props) {
return <img src={Logo} alt="Telegram Logo" {...props} />;
}

function init(settings) {
const initSettings = {
protocol: 'rtmps://',
stream_url: '',
stream_key: '',
...settings,
};

return initSettings;
}

function Service(props) {
const settings = init(props.settings);

const handleChange = (what) => (event) => {
const value = event.target.value;

settings[what] = value;

const output = createOutput(settings);

props.onChange([output], settings);
};

const createOutput = (settings) => {
const output = {
address: settings.protocol + settings.stream_url + settings.stream_key,
options: ['-f', 'flv'],
};

return output;
};

return (
<Grid container spacing={2}>
<Grid item xs={12} md={3}>
<TextField
variant="outlined"
fullWidth
type="url"
label={<Trans>Protocol</Trans>}
value={settings.protocol}
onChange={handleChange('protocol')}
readOnly
disabled
/>
</Grid>
<Grid item xs={12} md={9}>
<TextField variant="outlined" fullWidth placeholder="dc4-1.rtmp.t.me/s/" label={<Trans>Server URL</Trans>} value={settings.stream_url} onChange={handleChange('stream_url')} />
</Grid>
<Grid item xs={12}>
<TextField variant="outlined" fullWidth placeholder="123456:ABCDEF" label={<Trans>Stream Key</Trans>} value={settings.stream_key} onChange={handleChange('stream_key')} />
</Grid>
</Grid>
);
}

Service.defaultProps = {
settings: {},
skills: {},
metadata: {},
streams: [],
onChange: function (output, settings) {},
};

export { id, name, version, stream_key_link, description, image_copyright, author, category, requires, ServiceIcon as icon, Service as component };
4 changes: 4 additions & 0 deletions src/views/Publication/Services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ import * as Image2 from './Image2';
import * as Instagram from './Instagram';
import * as Livespotting from './Livespotting';
import * as MPEGTS from './MPEGTS';
import * as Owncast from './Owncast';
import * as Red5 from './Red5';
import * as Restream from './Restream';
import * as RTMP from './RTMP';
import * as RTSP from './RTSP';
import * as SRT from './SRT';
import * as Telegram from './Telegram';
import * as Twitch from './Twitch';
import * as Twitter from './Twitter';
import * as UDP from './UDP';
Expand Down Expand Up @@ -62,12 +64,14 @@ registry.Register(Twitch);
registry.Register(Instagram);
registry.Register(Vimeo);
registry.Register(Restream);
registry.Register(Telegram);
registry.Register(Livespotting);
registry.Register(Brightcove);
registry.Register(Akamai);
registry.Register(DaCast);
registry.Register(CDN77);
registry.Register(Core);
registry.Register(Owncast);
registry.Register(WOWZA);
registry.Register(Red5);
registry.Register(Icecast);
Expand Down
1 change: 1 addition & 0 deletions src/views/Publication/Services/logos/owncast.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/views/Publication/Services/logos/telegram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fbe9d91

Please sign in to comment.