Node Media Server package and c RTMP server ... DEMO:
Node Media Server package & RTMP Server
Node Media Server package & RTMP Server
npm version (recommended)
mkdir nms
cd nms
npm install node-media-server
vi app.js
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();
node app.js
xserver-xorg version 1.18.4 or newer is recommended to avoid potential performance issues with certain features in OBS, such as the fullscreen projector.
FFmpeg is required. If you do not have the FFmpeg installed (if you're not sure, then you probably don't have it), you can get it with the following commands:
sudo apt install ffmpeg
Then you can install OBS with the following commands, make sure you enabled the multiverse repo in Ubuntu's software center (NOTE: On newer versions of ubuntu adding a repository automatically apt updates.):
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt update
sudo apt upgrade
sudo apt install obs-studio
or
sudo snap install obs-studio
Run OBS with the following command:
obs-studio
or OBS Studio Ubuntu using Ubuntu Software-GUIs
SETTINGS => Stream
STREAM TYPE => Custom Streaming Server
URL => rtmp://localhost/live
STREAM KEY => 1 (for the stream with ID:1)
CLOSE SETTINGS
PRESS THE BUTTON => Start Streaming
RESULT: http://localhost:3000/streams/1
node index.js
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();
Node Media Server v2.1.9
Node Media Rtmp Server started on port: 1935
Node Media Http Server started on port: 8000
Node Media WebSocket Server started on port: 8000
Heroku support says that they only allow 80 and 443 HTTP/S ports and they do not officially support RTMP.
-
Docker + AWS
-
https://vercel.com/ (do not support)
Разработка приложения для потокового вещания с помощью Node.js и React