大网数据广告活动
Web 标准与前端开发

RTCRtpSender

· 52CE 我爱测

The **`RTCRtpSender`** interface provides the ability to control and obtain details about how a particular MediaStreamTrack is encoded and sent to a remote peer.

WebRTC

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 RTCDTMFSender which can be used to send DTMF codes (to simulate the user pressing buttons on a telephone's dial pad) to the remote peer.

Instance properties

  • RTCRtpSender.dtmf
    • : An RTCDTMFSender which can be used to send DTMF tones using telephone-event payloads on the RTP session represented by the RTCRtpSender object. If null, the track and/or the connection doesn't support DTMF. Only audio tracks can support DTMF.
  • RTCRtpSender.track
    • : The MediaStreamTrack which is being handled by the RTCRtpSender. If track is null, the RTCRtpSender doesn't transmit anything.
  • RTCRtpSender.transport
    • : The RTCDtlsTransport over which the sender is exchanging the RTP and RTCP packets used to manage transmission of media and control data. This value is null until the transport is established. When bundling is in use, more than transceiver may be sharing the same transport object.
  • RTCRtpSender.transform
    • : An RTCRtpScriptTransform is used to insert a transform stream (TransformStream) running in a worker thread into the sender pipeline, allowing stream transforms to be applied to encoded video and audio frames after they are output by a codec, and before they are sent.

Obsolete properties

  • rtcpTransport
    • : This property has been removed; the RTP and RTCP transports have been combined into a single transport. Use the RTCRtpSender.transport property instead.

Static methods

  • RTCRtpSender.getCapabilities_static
    • : Returns an object describing the system's capabilities for sending a specified kind of media data.

Instance methods

  • RTCRtpSender.getParameters()
    • : Returns an object describing the current configuration for the encoding and transmission of media on the track.
  • RTCRtpSender.getStats()
    • : Returns a Promise which is fulfilled with a RTCStatsReport which provides statistics data for all outbound streams being sent using this RTCRtpSender.
  • RTCRtpSender.setParameters()
    • : Applies changes to parameters which configure how the track is encoded and transmitted to the remote peer.
  • RTCRtpSender.setStreams()
    • : Sets the MediaStream associated with the RTCRtpSender.track being transmitted by this sender.
  • RTCRtpSender.replaceTrack()
    • : Attempts to replace the track currently being sent by the RTCRtpSender with another track, without performing renegotiation. This method can be used, for example, to toggle between the front- and rear-facing cameras on a device.

Specifications

Browser compatibility

See also

  • WebRTC API
  • RTCPeerConnection.addTrack()
  • RTCPeerConnection.getSenders()
  • RTCRtpReceiver

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。