RTCPeerConnection: pendingRemoteDescription 屬性

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2020 年 1 月⁩ 起,所有主流瀏覽器均已支援。

pendingRemoteDescriptionRTCPeerConnection 介面的一個只讀屬性,它返回一個 RTCSessionDescription 物件,該物件描述了連線遠端端點的一個待處理的配置更改。

這並不描述連線當前的狀態,而是描述連線在不久的將來可能的狀態。使用 RTCPeerConnection.currentRemoteDescriptionRTCPeerConnection.remoteDescription 來獲取遠端端點的當前會話描述。有關它們之間區別的詳細資訊,請參閱 WebRTC 連線頁面中的 待處理和當前描述

如果遠端描述更改正在進行中,則這是一個描述提議配置的 RTCSessionDescription 物件。否則,返回 null

示例

此示例檢查 pendingRemoteDescription 以確定是否正在處理描述更改。

js
const pc = new RTCPeerConnection();
// …
const sd = pc.pendingRemoteDescription;
if (sd) {
  // There's a description change underway!
} else {
  // No description change pending
}

規範

規範
WebRTC:瀏覽器中的即時通訊
# dom-peerconnection-pendingremotedesc

瀏覽器相容性

注意: pendingRemoteDescriptioncurrentRemoteDescription 新增到 WebRTC 規範中是相對較新的。在不支援它們的瀏覽器中,只有 remoteDescription 可用。

另見