The RTCPeerConnection.setConfiguration()
method sets the current configuration of the RTCPeerConnection
based on the values included in the specified object. This lets you change the ICE servers used by the connection and which transport policies to use.
The most common use case for this method (and even then, probably not a very common use case) is to replace the set of ICE servers to be used. Two potential scenarios in which this might be done:
- The
RTCPeerConnection
was instantiated without specifying any ICE servers. If, for example, theRTCPeerConnection()
constructor was called with no parameters, you would have to then callsetConfiguration()
to add ICE servers before ICE negotiation could begin. - Renegotiation of the connection is needed, and a different set of ICE servers needs to be used for some reason. Perhaps the user has moved into a new region, so using new regional ICE servers is necessary, for example. In this situation, one might call
setConfiguration()
to switch to new regional ICE servers, then initiate an ICE restart.
Note: You cannot change the identity information for a connection once it's already been set.