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

expose addStream on prototype #50

Closed
yocontra opened this issue Dec 5, 2015 · 6 comments
Closed

expose addStream on prototype #50

yocontra opened this issue Dec 5, 2015 · 6 comments

Comments

@yocontra
Copy link
Collaborator

yocontra commented Dec 5, 2015

right now you can only specify the stream in the constructor

you should be able to do it lazily after the connection has been opened, that way you can start the connection process as soon as possible instead of handling camera access and connection in series

@feross
Copy link
Owner

feross commented Dec 6, 2015

The downside of creating streams lazily is then you have to handle renegotiation.

@t-mullen
Copy link
Collaborator

t-mullen commented Apr 7, 2017

As an alternative to renegotiation, it's possible to merge MediaStreams before passing them into simple-peer. You can add/remove streams to this merged stream as you please, without renegotiation.

Not the ideal solution, but it's a workaround for some usecases until the spec around multistreaming stabilizes.

Demo

@ben-pr-p
Copy link

To force renegotation, I've been destroying and recreating Peer objects, and although this may involve slightly more renogiation than necessary it's been working for me.

If you're using react, check out the component I've wrapped it in to handle that logic for me https://github.com/ben-pr-p/assemble/blob/master/client/room/user-blob/webrtc/react-simple-peer.js

If you pass the component a new stream, it will handle renegotiation by destroying and recreating a Peer object internally.

@tvedtorama
Copy link

@rationalcoding I think your library looks like a promising solution for this problem, but I have a few questions:

  • Is the merging logic supported on the browsers that support WebRTC or just on Chrome?
  • Could you publish the source for your demo, I can't find it?
  • Is it possible to detect that there are "no streams in the merged stream"? Ie - that the host is currently not transmitting anything?
    • I guess this could be sent alongside the stream, on the data channel, but anyways...

@cusspvz
Copy link

cusspvz commented Mar 3, 2018

Being solved at #250

@t-mullen
Copy link
Collaborator

Implemented in #250.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants