RTCPeerConnection
方法
addTransceiver()
creates a new
RTCRtpTransceiver
and adds it to the set of transceivers associated with the
RTCPeerConnection
.
Each transceiver represents a bidirectional stream, with both an
RTCRtpSender
和
RTCRtpReceiver
associated with it.
rtpTransceiver = RTCPeerConnection.addTransceiver(trackOrKind, init);
trackOrKind
MediaStreamTrack
to associate with the transceiver, or a
DOMString
which is used as the
kind
of the receiver's
track
, and by extension of the
RTCRtpReceiver
本身。
init
可选
RTCRtpTransceiverInit
dictionary which provides any options that you may wish to specify when creating the new transceiver. Possible values are:
direction
可选
RTCRtpTransceiver
对象的
RTCRtpTransceiver.direction
特性。
sendEncodings
可选
RTCRtpSender
. Each entry is of type
RTCRtpEncodingParameters
.
流
可选
MediaStream
objects to add to the transceiver's
RTCRtpReceiver
; when the remote peer's
RTCPeerConnection
's
track
event occurs, these are the streams that will be specified by that event.
TypeError
trackOrKind
which is not valid. The string must be either
"audio"
or
"video"
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCPeerConnection.addTransceiver()' in that specification. |
候选推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
addTransceiver
|
Chrome 69 | Edge 79 | Firefox 59 | IE 不支持 No | Opera 不支持 No | Safari 11 | WebView Android 69 | Chrome Android 69 | Firefox Android 59 | Opera Android 不支持 No | Safari iOS Yes | Samsung Internet Android 10.0 |
完整支持
不支持
RTCPeerConnection.addTrack()
also creates transceivers
RTCRtpReceiver
and
RTCRtpSender
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