aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/rtcrtptransceiver/direction
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/direction
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/direction')
-rw-r--r--files/zh-cn/web/api/rtcrtptransceiver/direction/index.html72
1 files changed, 72 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>