doremeet / rtmp-server-nodejs

A Node.js implementation of RTMP Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RTMP-Server

npm npm npm

A Node.js implementation of RTMP Server

  • Supports only RTMP protocol.
  • Supports only H.264 video and AAC audio.

Install

npm install --save rtmp-server

Usage

const RtmpServer = require('rtmp-server');
const rtmpServer = new RtmpServer();

rtmpServer.on('error', err => {
  throw err;
});

rtmpServer.on('client', client => {
  //client.on('command', command => {
  //  console.log(command.cmd, command);
  //});

  client.on('connect', () => {
     console.log('connect', client.app);
  });
  
  client.on('play', ({ streamName }) => {
    console.log('PLAY', streamName);
  });
  
  client.on('publish', ({ streamName }) => {
    console.log('PUBLISH', streamName);
  });
  
  client.on('stop', () => {
    console.log('client disconnected');
  });
});

rtmpServer.listen(1935);

You can now publish streams to rtmp://localhost:1935/live and use any unique stream key.

The stream will then be available at rtmp://localhost:1935/<your stream key>.

License

GPL-2.0

About

A Node.js implementation of RTMP Server

License:GNU General Public License v2.0


Languages

Language:JavaScript 100.0%