大网数据广告活动
Web 标准与前端开发

RTCPeerConnection: currentRemoteDescription property

· 52CE 我爱测

The **`currentRemoteDescription`** read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing the remote end of the connection as it was most recently successfully negotiated since the last time the RTCPeerConnection finished negotiat

WebRTC

The currentRemoteDescription read-only property of the RTCPeerConnection interface returns an RTCSessionDescription object describing the remote end of the connection as it was most recently successfully negotiated since the last time the RTCPeerConnection finished negotiating and connecting to a remote peer. Also included is a list of any ICE candidates that may already have been generated by the ICE agent since the offer or answer represented by the description was first instantiated.

To change the currentRemoteDescription, call RTCPeerConnection.setRemoteDescription(), which triggers a series of events which leads to this value being set. For details on what exactly happens and why the change isn't necessarily instantaneous, see Pending and current descriptions in the WebRTC Connectivity page.

[!NOTE] Unlike RTCPeerConnection.remoteDescription, this value represents the actual current state of the local end of the connection; remoteDescription may specify a description which the connection is currently in the process of switching over to.

Value

The current description of the remote end of the connection, if one has been set. If none has been successfully set, this value is null.

Examples

This example looks at the currentRemoteDescription and displays an alert containing the RTCSessionDescription object's type and sdp fields.

const pc = new RTCPeerConnection();
// …
const sd = pc.currentRemoteDescription;
if (sd) {
  alert(`Local session: type='${sd.type}'; sdp description='${sd.sdp}'`);
} else {
  alert("No local session yet.");
}

Specifications

Browser compatibility

See also

  • RTCPeerConnection.setRemoteDescription(), RTCPeerConnection.pendingRemoteDescription, RTCPeerConnection.remoteDescription
  • RTCPeerConnection.setRemoteDescription(), RTCPeerConnection.remoteDescription, RTCPeerConnection.pendingRemoteDescription
  • WebRTC

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。