RTCPeerConnection: localDescription プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

RTCPeerConnection.localDescription は読み取り専用プロパティで、接続のローカル側のセッションを説明する RTCSessionDescription を返します。 まだ設定されていない場合は null となります。

構文

js
const sessionDescription = peerConnection.localDescription

より基本的なレベルでは、 RTCPeerConnection.pendingLocalDescription のプロパティが null でない場合、その値が返されます。 それ以外の場合は、 RTCPeerConnection.currentLocalDescription の値が返されます。 このアルゴリズムの詳細と使用理由については、 WebRTC Connectivity ページの Pending and current descriptions を参照してください。

この例では localDescription を見て、RTCSessionDescription オブジェクトの typesdp フィールドを含むアラートを表示します。

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

仕様書

Specification
WebRTC: Real-Time Communication in Browsers
# dom-peerconnection-localdescription

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
localDescription

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報