1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
---
title: RTCRtpTransceiver
slug: Web/API/RTCRtpTransceiver
tags:
- API
- Interface
- Media
- MediaStreamTrack
- NeedsTranslation
- RTCRtpTransceiver
- RTP
- Reference
- SDP
- TopicStub
- Transceiver
- WebRTC
translation_of: Web/API/RTCRtpTransceiver
---
<div>{{APIRef("WebRTC")}}</div>
<p><span class="seoSummary">The WebRTC interface <strong><code>RTCRtpTransceiver</code></strong> describes a permanent pairing of an {{domxref("RTCRtpSender")}} and an {{domxref("RTCRtpReceiver")}}, along with some shared state.</span></p>
<p>Each {{Glossary("SDP")}} media section describes one bidirectional SRTP ("Secure Real Time Protocol") stream (excepting the media section for {{domxref("RTCDataChannel")}}, if present). This pairing of send and receive SRTP streams is significant for some applications, so <code>RTCRtpTransceiver</code> is used to represent this pairing, along with other important state from the media section. Each non-disabled SRTP media section is always represented by exactly one transceiver.</p>
<p>A transceiver is uniquely identified using its {{domxref("RTCRtpTransceiver.mid", "mid")}} property, which is the same as the media ID (<code>mid</code>) of its corresponding m-line. An <code>RTCRtpTransceiver</code> is <strong>associated</strong> with an m-line if its <code>mid</code> is non-null; otherwise it's considered disassociated.</p>
<h2 id="Properties">Properties</h2>
<dl>
<dt>{{domxref("RTCRtpTransceiver.currentDirection", "currentDirection")}} {{ReadOnlyInline}}</dt>
<dd>A read-only string from the enum {{domxref("RTCRtpTransceiverDirection")}} which indicates the transceiver's current directionality, or <code>null</code> if the transceiver is stopped or has never participated in an exchange of offers and answers. To change the transceiver's directionality, set the value of the {{domxref("RTCRtpTransceiver.direction", "direction")}} property.</dd>
<dt>{{domxref("RTCRtpTransceiver.direction", "direction")}}</dt>
<dd>A string from the enum {{domxref("RTCRtpTransceiverDirection")}} which is used to set the transceiver's desired direction.</dd>
<dt>{{domxref("RTCRtpTransceiver.mid", "mid")}} {{ReadOnlyInline}}</dt>
<dd>The media ID of the m-line associated with this transceiver. This association is established, when possible, whenever either a local or remote description is applied. This field is <code>null</code> if neither a local or remote description has been applied, or if its associated m-line is rejected by either a remote offer or any answer.</dd>
<dt>{{domxref("RTCRtpTransceiver.receiver", "receiver")}} {{ReadOnlyInline}}</dt>
<dd>The {{domxref("RTCRtpReceiver")}} object that handles receiving and decoding incoming media.</dd>
<dt>{{domxref("RTCRtpTransceiver.sender", "sender")}} {{ReadOnlyInline}}</dt>
<dd>The {{domxref("RTCRtpSender")}} object responsible for encoding and sending data to the remote peer.</dd>
<dt>{{domxref("RTCRtpTransceiver.stopped", "stopped")}}</dt>
<dd>Indicates whether or not sending and receiving using the paired <code>RTCRtpSender</code> and <code>RTCRtpReceiver</code> has been permanently disabled, either due to SDP offer/answer, or due to a call to {{domxref("RTCRtpTransceiver.stop", "stop()")}}.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<dl>
<dt>{{domxref("RTCRtpTransceiver.setCodecPreferences", "setCodecPreferences()")}}</dt>
<dd>A list of {{domxref("RTCRtpCodecParameters")}} objects which override the default preferences used by the {{Glossary("user agent")}} for the transceiver's codecs.</dd>
<dt>{{domxref("RTCRtpTransceiver.stop", "stop()")}}</dt>
<dd>Permanently stops the <code>RTCRtpTransceiver</code>. The associated sender stops sending data, and the associated receiver likewise stops receiving and decoding incoming data.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName("WebRTC 1.0", "#rtcrtptransceiver-interface", "RTCRtpTransceiver")}}</td>
<td>{{Spec2("WebRTC 1.0")}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<p>{{Compat("api.RTCRtpTransceiver")}}</p>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li><a href="/en-US/docs/Web/API/WebRTC_API">WebRTC API</a></li>
<li><a href="/en-US/docs/Web/API/WebRTC_API/Intro_to_RTP">Introduction to the Real-time Transport Protocol (RTP)</a></li>
<li>{{domxref("RTCPeerConnection.addTrack()")}} and {{domxref("RTCPeerConnection.addTransceiver()")}} both create transceivers</li>
<li>{{domxref("RTCRtpReceiver")}} and {{domxref("RTCRtpSender")}}</li>
</ul>
|