I am developing a voice chatting app
based on webRTC
using android libjingle
.I want to reconnect users by using ice restart when they change their network from wifi
to 4g or vice versa, or are disconnected. I have a question about implementing it by using libjingle
. I will write down how to implement ice restart function based on what I understood so let me know there is anything wrong.
Q: As I understand, at first I need to set ice start option to be true in the MediaConstraints
option without removing peer connection 객체 used for the first connection like below:
mediaConstraints.optional.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
Secondly, I need to update MediaConstrants
using the peer connection 객체(used for the first connection)'s updateIce method like below:
peerConnection.updateIce(iceServers, mediaConstraints);
And finally is it right to send an offer, which is the same with basic webrtc
network?
For doing ice restart, sender should send SDP file with different ice-pwd or ice-ufrag. IceRestart option forces PeerConnection to update those values.
Steps should be:
cons.mandatory.add(new MediaConstraints.KeyValuePair("IceRestart", "true"));
pc.createOffer(new WebRtcObserver(callbacks), cons);
pc.setLocalDescription(new WebRtcObserver(callbacks), sdp);
So steps 2-4 are the same as for regular offer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With