RTCConfiguration
dictionary's
bundlePolicy
property is a string value indicating which SDP bundling policy, if any, to use for the underlying
RTP
streams used by an
RTCPeerConnection
.
The configuration object is used as an input to the
RTCPeerConnection()
构造函数。
let rtcConfiguration = {
bundlePolicy: policy
};
rtcConfiguration.bundlePolicy = policy;
A
DOMString
identifying the SDP bundling policy to use for the RTP streams used by the
RTCPeerConnection
. This string, which must be a member of the
RTCBundlePolicy
enumeration, has the following possible values:
balanced
RTCDtlsTransport
to handle each type of content added: one for audio, one for video, and one for the RTC data channel, if applicable. If the remote peer isn't BUNDLE-aware, the ICE agent chooses one audio track and one video track and those two tracks are each assigned to the corresponding
RTCDtlsTransport
. All other tracks are ignored by the connection.
This is the default, and most compatible, policy.
max-compat
RTCDtlsTransport
for each media track and a separate one for the
RTCDataChannel
, if one is created. If the remote endpoint can't handle bundling, each media track is negotiated on its own separate transport. This introduces bundling but will fall back to not bundling if the remote peer can't handle it.
max-bundle
RTCDtlsTransport
to handle
all
of the connection's media. If the remote peer isn't bundle-compatible, only one media track is negotiated and the rest are ignored. This maximizes bundling at the risk of losing tracks if the remote peer can't do bundling.
If any other value is specified, no configuration is specified when creating the
RTCPeerConnection
, or if the
bundlePolicy
property isn't included in the
RTCConfiguration
object specified when creating the connection,
balanced
is assumed.
bundlePolicy
configuration option for an
RTCPeerConnection
specifies how the ICE agent should handle negotiation if the remote peer isn't compatible with the
SDP BUNDLE standard
. If the remote peer
is
bundle compatible, the policy is moot and all media tracks and the data channel are bundled onto a single
RTCDtlsTransport
at the completion of the negotiation process. Any other transports that were used during negotiation are then closed.
In technical terms, an SDP BUNDLE lets all of the media tracks (identified in the SDP from the
m=
lines) stream between two peers across a single
5-tuple
, that is, from a single IP and port on one peer to a single IP and port on another peer, all using the same
RTCDtlsTransport
.
The goal of bundling is to optimize performance by reducing the overhead of having multiple transports in play. The fewer RTP transports or bundles of RTP streams you have, the better the network performance will be.
All current major browsers are BUNDLE compatible.
The following example creates a new
RTCPeerConnection
with a configuration setting the connection's
bundlePolicy
to
max-compat
to maximize compatibility while attempting to optimize network use. It also specifies
stun:stun.example.com
作为
STUN
server for
ICE
to use during negotiation.
let config = {
iceServers: [
{
urls: [ "stun:stun.example.com" ]
},
],
bundlePolicy: "max-compat"
};
let pc = new RTCPeerConnection(config);
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCConfiguration.bundlePolicy' in that specification. |
候选推荐 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
bundlePolicy
|
Chrome 23 | Edge ≤79 | Firefox ? | IE 不支持 No | Opera Yes | Safari ? | WebView Android Yes | Chrome Android 57 | Firefox Android ? | Opera Android Yes | Safari iOS ? | Samsung Internet Android 7.0 |
完整支持
不支持
兼容性未知
RTCPeerConnection
RTCSessionDescription
RTCIceCandidate
RTCPeerConnectionIceEvent
RTCPeerConnectionIceErrorEvent
RTCCertificate
RTCRtpSender
RTCRtpReceiver
RTCRtpTransceiver
RTCDtlsTransport
RTCIceTransport
RTCTrackEvent
RTCSctpTransport
RTCDataChannel
RTCDataChannelEvent
RTCDTMFSender
RTCDTMFToneChangeEvent
RTCStatsReport
RTCErrorEvent
RTCDTMFSender
:
tonechange
RTCDataChannel
:
bufferedamountlow
RTCDataChannel
:
close
RTCDataChannel
:
closing
RTCDataChannel
:
error
RTCDataChannel
:
message
RTCDataChannel
:
open
RTCDtlsTransport
:
error
RTCDtlsTransport
:
statechange
RTCIceTransport
:
error
RTCIceTransport
:
gatheringstatechange
RTCIceTransport
:
selectedcandidatepairchange
RTCIceTransport
:
statechange
RTCPeerConnection
:
connectionstatechange
RTCPeerConnection
:
datachannel
RTCPeerConnection
:
icecandidate
RTCPeerConnection
:
icecandidateerror
RTCPeerConnection
:
iceconnectionstatechange
RTCPeerConnection
:
icegatheringstatechange
RTCPeerConnection
:
negotiationneeded
RTCPeerConnection
:
signalingstatechange
RTCPeerConnection
:
track
RTCSctpTransport
:
error