Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. RTCPeerConnection
  4. getConfiguration()

RTCPeerConnection: getConfiguration() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨October 2018⁩.

ThegetConfiguration() method of theRTCPeerConnection interface returns an object which indicates the current configuration of theRTCPeerConnection on which the method is called.

The returned configuration is the last configuration applied viasetConfiguration(), or ifsetConfiguration() hasn't been called, the configuration theRTCPeerConnection was constructed with.The configuration includes a list of the ICE servers used by the connection, information about transport policies, and identity information.

Syntax

js
getConfiguration()

Parameters

None.

Return value

An object describing theRTCPeerConnection's current configuration.SeeRTCPeerConnection() for more information on what options are allowed.

Examples

This example adds a new certificate to an active connection if it doesn't already haveone in use.

js
let configuration = myPeerConnection.getConfiguration();if (configuration.certificates?.length === 0) {  RTCPeerConnection.generateCertificate({    name: "RSASSA-PKCS1-v1_5",    hash: "SHA-256",    modulusLength: 2048,    publicExponent: new Uint8Array([1, 0, 1]),  }).then((cert) => {    configuration.certificates = [cert];    myPeerConnection.setConfiguration(configuration);  });}

This example fetches the current configuration of theRTCPeerConnection, then looks to see if it has any certificates set by examining whether or not (a) the configuration has a value forcertificates, and (b) whether its length is zero.

If it's determined that there are no certificates in place,RTCPeerConnection.generateCertificate() is called to create a new certificate; we provide a fulfillment handler which adds a new array containing the one newly-created certificate to the current configuration and passes it tosetConfiguration() to add the certificate to the connection.

Specifications

Specification
WebRTC: Real-Time Communication in Browsers
# dom-rtcpeerconnection-getconfiguration

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp