aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/rtcsessiondescription/index.html
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/rtcsessiondescription/index.html
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/rtcsessiondescription/index.html')
-rw-r--r--files/zh-cn/web/api/rtcsessiondescription/index.html167
1 files changed, 167 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/rtcsessiondescription/index.html b/files/zh-cn/web/api/rtcsessiondescription/index.html
new file mode 100644
index 0000000000..ff94b0eb5f
--- /dev/null
+++ b/files/zh-cn/web/api/rtcsessiondescription/index.html
@@ -0,0 +1,167 @@
+---
+title: RTCSessionDescription
+slug: Web/API/RTCSessionDescription
+translation_of: Web/API/RTCSessionDescription
+---
+<p>{{APIRef("WebRTC")}}{{SeeCompatTable}}</p>
+
+<p><strong><code>RTCSessionDescription</code></strong> 接口描述连接或潜在连接的一端的配置方式。 每一个<code>RTCSessionDescription</code> 由一个描述类型组成,该描述类型指示它所描述的请求/应答协商过程的{{Glossary("SDP")}} 协议的相关描述。</p>
+
+<p><code>RTCSessionDescription</code> 在两个对等点之间协商连接的过程涉及来回交换对象,每个描述都表示描述的发送者支持的连接配置选项的一个组合。一旦两个对等方就连接的配置达成一致,协商就完成了。</p>
+
+<h2 id="属性">属性</h2>
+
+<p><em><code>RTCSessionDescription</code> 接口不继承任何属性 </em></p>
+
+<dl>
+ <dt>{{domxref("RTCSessionDescription.type")}} {{ReadOnlyInline}}</dt>
+ <dd><code>{{anch("RTCSdpType")}}</code> 会话描述类型的原型枚举。</dd>
+</dl>
+
+<dl>
+ <dt>{{domxref("RTCSessionDescription.sdp")}} {{ReadOnlyInline}}</dt>
+ <dd>一个 {{domxref("DOMString")}} 包含会话的{{Glossary("SDP")}}协议描述。</dd>
+</dl>
+
+<h2 id="常数">常数</h2>
+
+<h3 id="RTCSdpType">RTCSdpType</h3>
+
+<p>当前枚举值定义当前会话描述的状态,例如这个属性: {{domxref("RTCSessionDescription.type", "type")}} 。 会话描述的值将使用如下值之一。</p>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Value</th>
+ <th scope="col">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>answer</code></td>
+ <td>SDP协议请求内容包含在属性{{domxref("RTCSessionDescription.sdp", "sdp")}}中。 换言之,此会话描述描述了商定的配置,并将被发送以完成协商。.</td>
+ </tr>
+ <tr>
+ <td><code>offer</code></td>
+ <td>该会话描述对象描述首次握手的请求/响应。会话过程从发送方到接收方。</td>
+ </tr>
+ <tr>
+ <td><code>pranswer</code></td>
+ <td>会话描述对象描述一个临时响应;也就是说,它是对以前的提议或临时答案的响应。</td>
+ </tr>
+ <tr>
+ <td><code>rollback</code></td>
+ <td>具有空会话描述的这种特殊类型用于回滚到以前的稳定状态。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="方法">方法</h2>
+
+<p><em><code>RTCSessionDescription</code> 不继承任何方法。</em></p>
+
+<dl>
+ <dt>{{domxref("RTCSessionDescription.RTCSessionDescription", "RTCSessionDescription()")}} {{deprecated_inline}}</dt>
+ <dd>该构造函数返回一个新的<code>RTCSessionDescription对象</code>。参数是 <code>RTCSessionDescriptionInit</code> 字典包含包含分配这两个属性的值。</dd>
+ <dt>{{domxref("RTCSessionDescription.toJSON()")}}</dt>
+ <dd>返回一个{{Glossary("JSON")}} 描述对象. 该对象包含两个值, {{domxref("RTCSessionDescription.type", "type")}} 和{{domxref("RTCSessionDescription.sdp", "sdp")}}。</dd>
+</dl>
+
+<h2 id="Example">Example<span id="cke_bm_72C" style="display: none;"> </span></h2>
+
+<pre class="brush: js">signalingChannel.onmessage = function (evt) {
+ if (!pc)
+ start(false);
+
+ var message = JSON.parse(evt.data);
+ if (message.sdp)
+ pc.setRemoteDescription(new RTCSessionDescription(message), function () {
+ // if we received an offer, we need to answer
+ if (pc.remoteDescription.type == "offer")
+ pc.createAnswer(localDescCreated, logError);
+ }, logError);
+ else
+ pc.addIceCandidate(new RTCIceCandidate(message.candidate),
+ function () {}, logError);
+};
+</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', '#rtcsessiondescription-class', 'RTCSessionDescription') }}</td>
+ <td>{{Spec2('WebRTC 1.0')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatVersionUnknown }} {{property_prefix("-moz")}}</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatNo() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/Guide/API/WebRTC" title="/en-US/docs/CSS/Using_CSS_animations">WebRTC</a></li>
+ <li>{{domxref("RTCPeerConnection.setLocalDescription()")}} and {{domxref("RTCPeerConnection.setRemoteDescription()")}}</li>
+</ul>