Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add events for video, audio, and data. #328

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nsthorat
Copy link

@nsthorat nsthorat commented Apr 24, 2020

This allows writing a relay without using ffmpeg (by using a client publisher to directly write to an RTMP endpoint by relaying this packet).

Example code for what this looks like:

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60
  },
  http: {port: 8000, allow_origin: '*'},
  logType: 3
};

var nms = new NodeMediaServer(config);
nms.run();

// This is another NMS or RTMP server.
let rp = new NodeRtmpClient('rtmp://localhost:1936/live/stream');
rp.startPush();

nms.on('video', (id, response) => {
  console.log(
      'got packet for ', id, 'with timestamp', response.timestamp)
  rp.pushVideo(response.payload, response.timestamp);
});

@hthetiot
Copy link
Contributor

hthetiot commented Nov 8, 2020

@nsthorat you should not commit with message "save", instead you should write a description of the changes.
In 15 years of git, your the first person i see doing this, and god know i have see lame commit messages.

@nsthorat
Copy link
Author

nsthorat commented Nov 9, 2020

We have squash and merge for a reason, @hthetiot.

matt-cassidy added a commit to matt-cassidy/Node-Media-Server that referenced this pull request Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants