Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. RTCSessionDescription
  4. RTCSessionDescription()

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 thecompatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

TheRTCSessionDescription() constructor creates a newRTCSessionDescription with its properties initialized as described in thespecified object.

Note:This constructor has been deprecated becauseRTCPeerConnection.setLocalDescription() and other methods which takeSDP as input now directly accept an object containing thetype andsdp properties, so you don't have to instantiate anRTCSessionDescription yourself.

Syntax

js
new RTCSessionDescription(options)

Values

options

An object providing the default values for the session description. It should contain the following properties:

type

Required. A string which is used to set thetype property of the newRTCSessionDescription object. Must be one of the validRTCSessionDescription.type values.

sdpOptional

A string containing aSDP message describing the session. This value is an empty string ("") by default and may not benull.

Example

This example uses the constructor to convert an SDP offer into anRTCSessionDescription object.

Note:This is no longer necessary, however;RTCPeerConnection.setLocalDescription() and other methods which takeSDP as input now directly accept plain objects, so you don't have to instantiate anRTCSessionDescription yourself.

js
navigator.getUserMedia({ video: true }, (stream) => {  pc.onaddstream({ stream });  // Adding a local stream won't trigger the onaddstream callback  pc.addStream(stream);  pc.createOffer((offer) => {    pc.setLocalDescription(      new RTCSessionDescription(offer),      () => {        // send the offer to a server to be forwarded to the friend you're calling.      },      error,    );  }, error);});

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp