An exercise followed from Stephen Grider's React course. It resembles a live streaming service.
ps. Install redux-form by using npm install redux-form --legacy-peer-deps
command if you have Node v15+ or npm v7+ releases installed. Otherwise, the usual command npm install --save redux-form
will cause a "code ERESOLVE" error that says "unable to resolve dependency tree".
This repository is only the client application. There is also a basic API to install. Follow these steps:
- Put this repository to a /client directory.
- Make an /api folder next to the /client directory.
- Inside the /api folder, run the
npm init
command. - Inside the /api folder, run the
npm install --save json-server
command. - Inside the /api folder, create a db.json file and write
{ "streams": [] }
inside it. - Open the package.json file, change the "test" line completely with
"start": "json-server -p 3001 -w db.json"
- Run
npm start
just before you start the client application.
One final thing to install alongside the client app is the RTMP server. Follow these steps:
- Make an /rtmp folder next to the /client directory.
- Inside the /rtmp folder, run the
npm init
command. - Inside the /rtmp folder, run the
npm install --save node-media-server
command. - Inside the /rtmp folder, create a index.js file and paste the following:
const NodeMediaServer = require('node-media-server');
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60
},
http: {
port: 8000,
allow_origin: '*'
}
};
var nms = new NodeMediaServer(config)
nms.run();
- Open the package.json file, change the "test" line completely with
"start": "node index.js"
- Run
npm start
just before you start the client application.
In the OBS (Open Broadcaster Software) (https://obsproject.com) Settings>Stream, select Custom for the Service. Write rtmp://localhost/live for Server and the stream ID for the Stream Key. Press Start Streaming. Visit the stream with the given ID on the client app. The stream will show on the video player.