The RTCRtpSender interface provides the ability to control and obtain details about how a particular MediaStreamTrack is encoded and sent to a remote peer. With it, you can configure the encoding used for the corresponding track, get information about the device's media capabilities, and so forth. You can also obtain access to an RTPDTMFSender which can be used to send DTMF codes to the remote peer.
Properties
RTCRtpSender.dtmfRead only- An
RTCDTMFSenderwhich can be used to send DTMF tones using"telephone-event"payloads on the RTP session represented by theRTCRtpSenderobject. Ifnull, the track and/or the connection doesn't support DTMF. Only audio tracks can support DTMF. RTCRtpSender.rtcpTransportRead only- The transport over which Real-time Transport Control Protocol (RTCP) information is exchanged. This value is
nullbefore theRTCDtlsTransportobject is created. When bundling is in use, more than oneRTCRtpSendercan share the same transport, sending all RTP and RTCP information over that one transport. RTCRtpSender.trackRead only- The
MediaStreamTrackwhich is being handled by theRTCRtpSender. Iftrackisnull, theRTCRtpSenderdoesn't transmit anything. RTCRtpSender.transportRead only- The
RTCDtlsTransportover which media data for thetrackis being transmitted. The data is transmitted using RTP packets. Before the transport is established, this value isnull.
Methods
RTCRtpSender.getParameters()- Returns a
RTCRtpParametersobject describing the current configuration for the encoding and transmission of media on thetrack. RTCRtpSender.setParameters()- Applies changes to parameters which configure how the
trackis encoded and transmitted to the remote peer. RTCRtpSender.replaceTrack()- Attempts to replace the track currently being sent by the
RTCRtpSenderwith another track, without performing renegotiation. This method can be used, for example, to toggle between the front- and rear-facing cameras on a device.
Static methods
RTCRtpSender.getCapabilities()- Returns an
RTCRtpCapabilitiesobject describing the system's capabilities for sending a specified kind of media data.
Example
tbd
Specifications
| Specification | Status | Comment |
|---|---|---|
| WebRTC 1.0: Real-time Communication Between Browsers The definition of 'RTCRtpSender' in that specification. |
Working Draft |
Browser compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | 34 (34) | No support | ? | ? |
dtmf |
(Yes) | (Yes) | 52 (52) | No support | ? | ? |
| Feature | Android | Chrome | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | ? | (Yes) | 34.0 (34) | ? | No support | ? | ? |
dtmf |
? | (Yes) | 52.0 (52) | ? | No support | ? | ? |