I am working on webRTC video calling. I got datachannel successfully implemented. Now I would like to add video stream to the same peer connection.
I have read that stream should be added before answer and offer. Is there a way to add stream after answer or offer?
In case I have added stream before offer or answer, how could I stop streaming and start it again when needed?
Could there be any issues in maintaining so many streams?
MediaStream should be added to peerconnection first only then exchange of offer, answer ,candidates should be done. If the onAddStream() is called ,that mean you are receiving the remote video.
To add stream after creating complete signalling, the Peer connection should renegotiate with stream.
Then once again create offer and send it to other Peer.
Remote peer will add stream and send answer SDP.
To stop streams:
In my experience, what Konga Raju advised didn't work. I couldn't send an "updated offer" and have the video streaming actually happen.
I found that this sequence of events works for my case, in which I wish to stream video from peer 1 to peer 2.
addIceCandidate
with itSetRemoteDescription
& make an answer & send itSetRemoteDescription
getUserMedia
call)getUserMedia
succeeds, we have a stream. CalladdStream
on the peer connection object.I haven't found a way to add video after step 9. When I want to change something, I go back to step 3.