RTCSessionDescription: RTCSessionDescription() constructor
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
The RTCSessionDescription() constructor creates a new RTCSessionDescription with its properties initialized as described in the specified object.
Note: This constructor has been deprecated because RTCPeerConnection.setLocalDescription() and other methods which take SDP as input now directly accept an object conforming to the RTCSessionDescriptionInit dictionary, so you don't have to instantiate an RTCSessionDescription yourself.
Syntax
new RTCSessionDescription(options)
Values
options Optional
-
An object providing the default values for the session description; the object conforms to the RTCSessionDescriptionInit dictionary. That dictionary has the following properties:
-
type
-
Required. A string which is used to set the type property of the new RTCSessionDescription object.
-
sdp
-
A string containing a SDP message describing the session. This value is an empty string ("") by default and may not be null.
Example
This example uses the constructor to convert an SDP offer into an RTCSessionDescription object.
Note: This is no longer necessary, however; RTCPeerConnection.setLocalDescription() and other methods which take SDP as input now directly accept an object conforming to the RTCSessionDescriptionInit dictionary, so you don't have to instantiate an RTCSessionDescription yourself.
navigator.getUserMedia({ video: true }, (stream) => {
pc.onaddstream({ stream });
pc.addStream(stream);
pc.createOffer((offer) => {
pc.setLocalDescription(
new RTCSessionDescription(offer),
() => {
},
error,
);
}, error);
});
Specifications
This feature is not part of any current specification. It is no longer on track to become a standard.
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
RTCSessionDescription |
23 |
15 |
4422 |
No |
15 |
11 |
4.4 |
25 |
4424 |
14 |
11 |
1.5 |
See also