node-webrtc / node-webrtc-examples

MediaStream and RTCDataChannel examples using node-webrtc
508 stars 161 forks source link

How to connect 2 browser clients in video-compositing example? #7

Closed Glunky closed 4 years ago

Glunky commented 4 years ago

Hi! In video-compositing example we exchange data only between 1 browser client. What should i do to detect second connection and only then produce connection? So that 1st browser client get stream from second browser client and 2nd browser client get stream from 1st browser client? Please, provide any idea or information to do that.

markandrus commented 4 years ago

I don’t really recommend it beyond demo purposes (you won’t get good performance compared to a proper MCU). That being said, you’d need to rework the server-side signaling components in lib/server to support connecting more than one client at a time.

tzvc commented 4 years ago

@markandrus Can you elaborate on

you won’t get good performance compared to a proper MCU

What is the difference in terms of performance with a MCU like Kurento? I though this was just a wrapper over some fast c++ implementation

markandrus commented 4 years ago

A proper MCU/SFU would do the minimal amount of re-encoding. node-webrtc is just a wrapper around the WebRTC client library shipped in Chromium, and so it will re-encode MediaStreamTracks per RTCPeerConnection.