As a Nodejs beginner, I am using the rtsp-relay library for live streaming. Currently, it is working in the frontend when the URL is included in the server proxy object like this:
rtsp://.....@..../Stream/Channel/10
. However, I want users to be able to input the URL in a TextField on the frontend instead of including it in the server. Should I use fetch and send for this? Any advice or help would be appreciated. Please note that English is not my native language, so there may be mistakes in my explanation.
const express = require('express');
const app = express();
const { proxy, scriptUrl } = require('rtsp-relay')(app);
const handle = proxy({
url: `rtsp://.....@..../Stream/Channel/10`,
// the URL above is credentials
verbose: false,
transport: 'tcp',
});
app.ws('/api/stream', handle );
app.get('/', (req, res) =>
res.send(
`hg`,
),
);
app.listen(5000);
React (material-ui):
const updateUrl = () => {
return (
<React.Fragment>
<Box>
<form
onSubmit={handleUpdate}>
<div>
<Box>
<Button
onClick={nulll}
aria-label="close-settings-popup">
<Close />
</Button>
</Box>
</div>
<FormGroup>
<Box>
<FormControl>
<TextField
type="text"
id="URL"
value={source}
onChange={handleChange}
label={
<Trans i18nKey="form.cameraForm.source">URL</Trans>
}
></TextField>
</FormControl>
</Box>
</FormGroup>
<div>
<Button type="submit" variant="contained" color="primary">
Accept
</Button>
</div>
</form>
</Box>
</React.Fragment>
);
};
This is what the rtsp creator wrote: