The RTCIceServer
dictionary's credential
property is a string providing the credential to use when connecting to the described server. This is typically a password, key, or other secret.
Note: This value is used when the RTCIceServer
describes a TURN server.
const iceServer = {
credential: someCredential,
};
const credential = iceServer.credential;
iceServer.credential = newCredential;
This example creates a new RTCPeerConnection
which uses a TURN server at turnserver.example.org
to negotiate connections. Logging into the TURN server uses the username "webrtc" and the creative password "turnpassword".
myPeerConnection = new RTCPeerConnection({
iceServers: [
{
urls: "turn:turnserver.example.org",
username: "webrtc",
credential: "turnpassword",
},
],
});