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
The downside of creating streams lazily is then you have to handle renegotiation.
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.
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.
@RationalCoding I think your library looks like a promising solution for this problem, but I have a few questions:
Being solved at #250
Implemented in #250.
Most helpful comment
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.