这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
RTCPeerConnection.getConfiguration()
method returns an
RTCConfiguration
object which indicates the current configuration of the
RTCPeerConnection
on which the method is called.
The returned configuration is the last configuration applied via
setConfiguration()
,或者若
setConfiguration()
hasn't been called, the configuration the
RTCPeerConnection
was constructed with. The configuration includes a list of the ICE servers used by the connection, information about transport policies, and identity information.
var configuration = RTCPeerConnection.getConfiguration();
This method takes no input parameters.
RTCConfiguration
object describing the
RTCPeerConnection
's current configuration.
This example adds a new certificate to an active connection if it doesn't already have one in use.
let configuration = myPeerConnection.getConfiguration();
if ((configuration.certificates != undefined) && (!configuration.certificates.length)) {
RTCPeerConnection.generateCertificate({
name: 'RSASSA-PKCS1-v1_5',
hash: 'SHA-256',
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1])
}).then(function(cert) {
configuration.certificates = [cert];
myPeerConnection.setConfiguration(configuration);
});
}
This example fetches the current configuration of the
RTCPeerConnection
, then looks to see if it has any certificates set by examining whether or not (a) the configuration has a value for
certificates
, 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 to
setConfiguration()
to add the certificate to the connection.
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'getConfiguration()' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getConfiguration
|
Chrome 70 | Edge 15 | Firefox 22 | IE 不支持 No |
Opera
43
注意事项
|
Safari 11 | WebView Android 70 | Chrome Android 70 | Firefox Android 44 |
Opera Android
43
注意事项
|
Safari iOS Yes | Samsung Internet Android 6.0 |
完整支持
不支持
见实现注意事项。
RTCPeerConnection
canTrickleIceCandidates
connectionState
currentLocalDescription
currentRemoteDescription
getDefaultIceServers()
iceConnectionState
iceGatheringState
localDescription
onaddstream
onconnectionstatechange
ondatachannel
onicecandidate
oniceconnectionstatechange
onicegatheringstatechange
onidentityresult
onidpassertionerror
onidpvalidationerror
onnegotiationneeded
onpeeridentity
onremovestream
onsignalingstatechange
ontrack
peerIdentity
pendingLocalDescription
pendingRemoteDescription
remoteDescription
sctp
signalingState
addIceCandidate()
addStream()
addTrack()
close()
createAnswer()
createDataChannel()
createOffer()
generateCertificate()
getConfiguration()
getIdentityAssertion()
getReceivers()
getSenders()
getStats()
getStreamById()
getTransceivers()
removeStream()
removeTrack()
restartIce()
setConfiguration()
setIdentityProvider()
setLocalDescription()
setRemoteDescription()
MediaDevices.getUserMedia()
Navigator.mediaDevices
RTCCertificate
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCDataChannel
RTCDataChannelEvent
RTCDtlsTransport
RTCErrorEvent
RTCIceCandidate
RTCIceTransport
RTCPeerConnectionIceErrorEvent
RTCPeerConnectionIceEvent
RTCRtpReceiver
RTCRtpSender
RTCRtpTransceiver
RTCSctpTransport
RTCSessionDescription
RTCStatsEvent
RTCStatsReport
RTCTrackEvent