RTCRtpReceiver

The receiver that receives and decodes remote media.

class webrtc.interfaces.rtc_rtp_receiver.RTCRtpReceiver(native_obj=None)

Receives and decodes remote media into a webrtc.MediaStreamTrack.

Each webrtc.RTCRtpTransceiver of an webrtc.RTCPeerConnection has one.

See MDN: RTCRtpReceiver.

property track: MediaStreamTrack

The track the received media plays on. It exists from the start.

See MDN: RTCRtpReceiver/track.

Type:

webrtc.MediaStreamTrack

property transport: RTCDtlsTransport | None

The transport the packets come over.

It’s None until there’s one. See MDN: RTCRtpReceiver/transport.

Type:

webrtc.RTCDtlsTransport, optional

property transform: RTCRtpScriptTransform | RTCRtpSFrameDecryptor | None

The frame transform.

It changes the encoded frames before they’re decoded. With None, frames are decoded as received. A transform serves one sender or receiver for its lifetime, so once attached it can’t be set elsewhere.

See MDN: RTCRtpReceiver/transform.

Raises:
Type:

webrtc.RTCRtpScriptTransform or webrtc.RTCRtpSFrameDecryptor, optional

property jitter_buffer_target: float | None

The target delay of the jitter buffer in milliseconds, from 0 to 4000.

A higher value adds latency for smoother playback. None leaves it to the receiver.

See MDN: RTCRtpReceiver/jitterBufferTarget.

Raises:
Type:

float, optional

get_parameters()

Returns the parameters the receiver receives with.

See MDN: RTCRtpReceiver/getParameters.

Returns:

webrtc.RTCRtpReceiveParameters – The parameters.

Return type:

RTCRtpReceiveParameters

static get_capabilities(kind)

Returns the codecs and header extensions receivers of a kind support.

See MDN: RTCRtpReceiver/getCapabilities_static.

Parameters:

kind (webrtc.MediaType) – Audio or video.

Returns:

webrtc.RTCRtpCapabilities, optional – The capabilities, or None for another kind.

Return type:

RTCRtpCapabilities | None

async get_stats()

Collects the stats of the receiver and of the objects they refer to.

See MDN: RTCRtpReceiver/getStats.

Returns:

webrtc.RTCStatsReport – The stats.

Raises:

webrtc.InvalidStateError – If the connection is closed.

Return type:

RTCStatsReport

get_synchronization_sources()

Returns the synchronization sources (SSRCs) of the media received in the last 10 seconds.

See MDN: RTCRtpReceiver/getSynchronizationSources.

Returns:

list of webrtc.RTCRtpSynchronizationSource – The sources, the most recent first.

Return type:

list[RTCRtpSynchronizationSource]

get_contributing_sources()

Returns the contributing sources (CSRCs) of the media received in the last 10 seconds.

These are the original streams a mixer, like a conference server, combined into the received one.

See MDN: RTCRtpReceiver/getContributingSources.

Returns:

list of webrtc.RTCRtpContributingSource – The sources, the most recent first.

Return type:

list[RTCRtpContributingSource]