RTCIceServer.username

The RTCIceServer dictionary's username property is a string which specifies the username to use when authenticating with the ICE server being described.

Note: This value is used when the RTCIceServer describes a TURN server.

Syntax

const iceServer = {
  // ...
  username: someUsername,
  // ...
};

const username = iceServer.username;

iceServer.username = newUsername;

Example

This example creates a new RTCPeerConnection which will use a TURN server at turnserver.example.org to negotiate connections. Logging into the TURN server will use the username "webrtc" and the creative password "turnpassword".

myPeerConnection = new RTCPeerConnection({
  iceServers: [
    {
      urls: "turn:turnserver.example.org",  // A TURN server
      username: "webrtc",
      credential: "turnpassword"
    }
  ]
});

Specifications

Specification
WebRTC 1.0: Real-Time Communication Between Browsers
# dom-rtciceserver-username

Browser compatibility

BCD tables only load in the browser

See also