aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/rtcrtptransceiver
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/rtcrtptransceiver
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/rtcrtptransceiver')
-rw-r--r--files/zh-cn/web/api/rtcrtptransceiver/direction/index.html72
-rw-r--r--files/zh-cn/web/api/rtcrtptransceiver/index.html85
2 files changed, 157 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/rtcrtptransceiver/direction/index.html b/files/zh-cn/web/api/rtcrtptransceiver/direction/index.html
new file mode 100644
index 0000000000..09b0fba213
--- /dev/null
+++ b/files/zh-cn/web/api/rtcrtptransceiver/direction/index.html
@@ -0,0 +1,72 @@
+---
+title: RTCRtpTransceiver.direction
+slug: Web/API/RTCRtpTransceiver/direction
+translation_of: Web/API/RTCRtpTransceiver/direction
+---
+<div>{{APIRef("WebRTC")}}</div>
+
+<p><span class="seoSummary">The {{domxref("RTCRtpTransceiver")}} property <code><strong>direction</strong></code> is a string which indicates the transceiver's preferred directionality.</span> Its value must be one of the strings defined by the {{domxref("RTCRtpTransceiverDirection")}} enumeration.</p>
+
+<p>The transceiver's <em>current</em> direction is indicated by the {{domxref("RTCRtpTransceiver.currentDirection", "currentDirection")}} property.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox notranslate">var <em>direction</em> = <em>RTCRtpTransceiver</em>.direction</pre>
+
+<h3 id="Value">Value</h3>
+
+<p>A {{domxref("DOMString")}} whose value is one of the strings which are a member of the <code>RTCRtpTransceiverDirection</code> enumerated type, indicating the transceiver's preferred direction. {{page("/en-US/docs/Web/API/RTCRtpTransceiverDirection", "Values")}}</p>
+
+<h3 id="Exceptions">Exceptions</h3>
+
+<p>When setting the value of <code>direction</code>, the following exceptions can occur:</p>
+
+<dl>
+ <dt><code>InvalidStateError</code></dt>
+ <dd>Either the receiver's {{domxref("RTCPeerConnection")}} is closed or the {{domxref("RTCRtpReceiver")}} is stopped.</dd>
+</dl>
+
+<h2 id="Usage_notes">Usage notes</h2>
+
+<h3 id="Setting_the_direction">Setting the direction</h3>
+
+<p>When you change the value of <code>direction</code>, an <code>InvalidStateError</code> exception will occur if the connection is closed or the receiver is stopped.</p>
+
+<p>If the new value of <code>direction</code> is in fact different from the existing value, renegotiation of the connection is required, so a {{event("negotiationneeded")}} event is sent to the {{domxref("RTCPeerConnection")}}.</p>
+
+<h3 id="Effect_on_offers_and_answers">Effect on offers and answers</h3>
+
+<p>The value of <code>direction</code> is used by {{domxref("RTCPeerConnection.createOffer()")}} or {{domxref("RTCPeerConnection.createAnswer()")}} in order to generate the SDP generated by each of those methods. The SDP contains an a-line which specifies the directionality. For example, if the <code>direction</code> is specified as <code>"sendrecv"</code>, the corresponding SDP a-line is:</p>
+
+<pre class="notranslate">a=sendrecv</pre>
+
+<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", "#dom-rtcrtptransceiver-direction", "RTCRtpTransceiver.direction")}}</td>
+ <td>{{Spec2("WebRTC 1.0")}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<div>
+
+
+<p>{{Compat("api.RTCRtpTransceiver.direction")}}</p>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{domxref("RTCRtpTransceiver.currentDirection")}}</li>
+</ul>
diff --git a/files/zh-cn/web/api/rtcrtptransceiver/index.html b/files/zh-cn/web/api/rtcrtptransceiver/index.html
new file mode 100644
index 0000000000..2bd4589dab
--- /dev/null
+++ b/files/zh-cn/web/api/rtcrtptransceiver/index.html
@@ -0,0 +1,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>