question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unable to get remote stream in case when a “remote stream” is attached by calling “peer.addStream(remoteStream)

See original GitHub issue

Issue: unable to get remote stream in case when a “remote stream” is attached by calling “peer.addStream ( remoteStream )”

Is it beneficial to attach remote stream?

Yeah, it allows us overcome burden from a single peer. Burden will be shared.

Also, we can support a wide range of peer’s connectivity.

How to attach remote stream?

var MediaStream = window.webkitMediaStream || window.MediaStream;

firstPeer.onaddstream = function(remoteSteam) {
      remoteStream = new MediaStream(remoteSteam.audioTracks, remoteSteam.videoTracks);
      otherPeer.addStream(remoteStream);  /* attaching remote stream */
};

What I want to do?

WebRTC -Experiment

  1. First peer will handle first three peers
  2. 2nd peer will handle next three peers (5, 6, 7)
  3. 5th peer will handle next three peers (8,9,10)
  4. 8th peer will handle next three peers (11, 12, 13)
  5. And so on.

We will get following benefits (in case of success):

  1. Video will never freeze for 11th and upper peers
  2. 1st peer don’t need to handle all participants
  3. You don’t need to install/buy a middle server (like Asterisk) for small projects (to support a few hundred peers’ connectivity)

A known bug in chromium: peer.onicecandidate not fires for 11th peer. You don’t need to worry about that bug!!

Pitfall: If peer number 1, 2, 5, 8 … tries to leave the room without informing other peers to play a host role.

WebRTC -Experiment

If peer number 2 leaves the room, without informing master peer or peer number 5 to handling upcoming peers.

A demo experiment to test it:

https://googledrive.com/host/0B6GWd_dUUTT8V1Fodm9WQldkb28/

Open 4 tabs…1st table should create room………join room from other tabs…see the behavior of the 4th tab.

Issue Analytics

  • State:open
  • Created 11 years ago
  • Comments:41 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
HiroakiLioncommented, Jan 4, 2021

Any progress on this module? I’m looking for a solution for 100-200 listeners vs 1 streamer.

1reaction
atsepkovcommented, Sep 1, 2016

@muaz-khan For solving the problem you describe with peer-5 leaving, could the server instead tell peer 6 or 7 (who should be in the same link in the chain as 5) to take over instead? Similarly, could this system be made redundant/safe by having each child peer be aware of all 3 parent peers in the chain and fallback automatically if one drops?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - unable to get remote stream in case when a “remote ...
unable to get remote stream in case when a “remote stream” is attached by calling “peer.addStream(remoteStream) ... by calling “peer.addStream(remoteStream).
Read more >
Remote VideoStream not working with WebRTC
You must call the addStream method of the peer connection object before you ... Angular p2p video chat - remote stream is black...
Read more >
WebRTC Error: Failed to create remote session description ...
function handleRemoteStreamAdded(event) { console.log("Remote stream added."); setRemoteVideo(event.stream); remoteStream = event.stream; } ...
Read more >
A simple p2p video conference – the browser application
We also want to store a reference to the remote stream in order to use it later: remoteStream = event.stream; }; Copy. The...
Read more >
WebRTC · WebPlatform Docs
RTCPeerConnection : making a call; Signaling with the Channel API ... once remote stream arrives, show it in the remote video element pc.onaddstream ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found