From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../rtcpeerconnection/remotedescription/index.html | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 files/zh-cn/web/api/rtcpeerconnection/remotedescription/index.html (limited to 'files/zh-cn/web/api/rtcpeerconnection/remotedescription') 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 +--- +

{{APIRef("WebRTC")}}{{SeeCompatTable}}

+ +

只读属性 RTCPeerConnection.remoteDescription 返回一个 {{domxref("RTCSessionDescription")}} ,它描述了和远程对端之间的会话(包括配置和媒体信息) ,如果还没有被设置过的话,它会是 null.

+ +

这个值通常是通过信令服务器接收的对端的会话描述(作为提议或应答),调用{{domxref("RTCPeerConnection.setRemoteDescription()")}}之后生效。

+ +

语法

+ +
 var sessionDescription = peerConnection.remoteDescription;
+ +

从更基础的层面上看,如果该属性不为null,则返回值为{{domxref("RTCPeerConnection.pendingRemoteDescription")}}的值,否则,返回{{domxref("RTCPeerConnection.currentRemoteDescription")}}的值。有关此算法的详细信息及其使用原因,请参阅{{SectionOnPage("/en-US/docs/Web/API/WebRTC_API/Connectivity", "Pending and current descriptions")}}。

+ +

示例

+ +

此示例查看remoteDescription并显示包含{{domxref("RTCSessionDescription")}}对象的typesdp字段的警告。

+ +
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.");
+}
+
+ +

规范

+ + + + + + + + + + + + + + + + +
标准状态说明
{{ SpecName('WebRTC 1.0', '#widl-RTCPeerConnection-remoteDescription', 'RTCPeerConnection.remoteDescription') }}{{ Spec2('WebRTC 1.0') }}初始化规范
+ +

浏览器兼容性

+ + + +

{{Compat("api.RTCPeerConnection.remoteDescription")}}

+ +

相关链接

+ + -- cgit v1.2.3-54-g00ecf