diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/rtcpeerconnection/remotedescription | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/rtcpeerconnection/remotedescription')
-rw-r--r-- | files/zh-cn/web/api/rtcpeerconnection/remotedescription/index.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/rtcpeerconnection/remotedescription/index.html b/files/zh-cn/web/api/rtcpeerconnection/remotedescription/index.html new file mode 100644 index 0000000000..3c619163d6 --- /dev/null +++ b/files/zh-cn/web/api/rtcpeerconnection/remotedescription/index.html @@ -0,0 +1,71 @@ +--- +title: RTCPeerConnection.remoteDescription +slug: Web/API/RTCPeerConnection/remoteDescription +tags: + - RTCPeerConnection + - WebRTC + - remoteDescription + - 中文 +translation_of: Web/API/RTCPeerConnection/remoteDescription +--- +<p>{{APIRef("WebRTC")}}{{SeeCompatTable}}</p> + +<p>只读属性 <code><strong>RTCPeerConnection.remoteDescription</strong></code> 返回一个 {{domxref("RTCSessionDescription")}} ,它描述了和远程对端之间的会话(包括配置和媒体信息) ,如果还没有被设置过的话,它会是 <code>null</code>.</p> + +<p>这个值通常是通过信令服务器接收的对端的会话描述(作为提议或应答),调用{{domxref("RTCPeerConnection.setRemoteDescription()")}}之后生效。</p> + +<h2 id="语法">语法</h2> + +<pre> var <em>sessionDescription</em> = <em>peerConnection</em>.remoteDescription;</pre> + +<p>从更基础的层面上看,如果该属性不为<code>null</code>,则返回值为{{domxref("RTCPeerConnection.pendingRemoteDescription")}}的值,否则,返回{{domxref("RTCPeerConnection.currentRemoteDescription")}}的值。有关此算法的详细信息及其使用原因,请参阅{{SectionOnPage("/en-US/docs/Web/API/WebRTC_API/Connectivity", "Pending and current descriptions")}}。</p> + +<h2 id="示例">示例</h2> + +<p>此示例查看<code>remoteDescription</code>并显示包含{{domxref("RTCSessionDescription")}}对象的<font face="consolas, Liberation Mono, courier, monospace"><span style="background-color: rgba(220, 220, 220, 0.5);">type</span></font>和<code>sdp</code>字段的警告。</p> + +<pre class="brush:js">var pc = new RTCPeerConnection(); +… +var sd = pc.remoteDescription; +if (sd) { + alert("Remote session: type='" + + sd.type + "'; sdp description='" + + sd.sdp + "'"); +} +else { + alert("No remote session yet."); +} +</pre> + +<h2 id="Specifications" name="Specifications">规范</h2> + +<table class="standard-table" style="height: 49px; width: 1000px;"> + <thead> + <tr> + <th scope="col">标准</th> + <th scope="col">状态</th> + <th scope="col">说明</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-remoteDescription', 'RTCPeerConnection.remoteDescription') }}</td> + <td>{{ Spec2('WebRTC 1.0') }}</td> + <td>初始化规范</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("api.RTCPeerConnection.remoteDescription")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{domxref("RTCPeerConnection.setRemoteDescription()")}}, {{domxref("RTCPeerConnection.pendingRemoteDescription")}}, {{domxref("RTCPeerConnection.currentRemoteDescription")}}</li> + <li>{{domxref("RTCPeerConnection.setLocalDescription()")}}, {{domxref("RTCPeerConnection.pendingLocalDescription")}}, {{domxref("RTCPeerConnection.currentLocalDescription")}}, {{domxref("RTCPeerConnection.localDescription")}}</li> + <li><a href="/en-US/docs/Web/Guide/API/WebRTC">WebRTC</a></li> +</ul> |