RTCPeerConnection: localDescription property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
ThelocalDescription read-only property of theRTCPeerConnection interface returns anRTCSessionDescription describing the session for the local end of the connection.If it has not yet been set, this isnull.
In this article
Value
On a more fundamental level, the returned value is the value ofRTCPeerConnection.pendingLocalDescription if that property isn'tnull;otherwise, the value ofRTCPeerConnection.currentLocalDescription is returned.SeePending and current descriptions in the WebRTC Connectivity page for details on this algorithm and why it's used.
Example
This example looks at thelocalDescription and displays an alert containing theRTCSessionDescription object'stype andsdp fields.
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.");}Specifications
| Specification |
|---|
| WebRTC: Real-Time Communication in Browsers> # dom-peerconnection-localdescription> |