aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/rtcsessiondescription/index.html
blob: 927204c7da3bec845c07ad669140bc54bcb72ebb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: RTCSessionDescription
slug: Web/API/RTCSessionDescription
tags:
  - API
  - Audio
  - Experimental
  - Interface
  - Media
  - NeedsTranslation
  - Reference
  - TopicStub
  - Video
  - Web
  - WebRTC
translation_of: Web/API/RTCSessionDescription
---
<p>{{APIRef("WebRTC")}}{{SeeCompatTable}}</p>

<p>The <strong><code>RTCSessionDescription</code></strong> interface describes one end of a connection—or potential connection—and how it's configured. Each <code>RTCSessionDescription</code> consists of a description {{domxref("RTCSessionDescription.type", "type")}} indicating which part of the offer/answer negotiation process it describes and of the {{Glossary("SDP")}} descriptor of the session.</p>

<p>The process of negotiating a connection between two peers involves exchanging <code>RTCSessionDescription</code> objects back and forth, with each description suggesting one combination of connection configuration options that the sender of the description supports. Once the two peers agree upon a configuration for the connection, negotiation is complete.</p>

<h2 id="Properties">Properties</h2>

<p><em>The <code>RTCSessionDescription</code> interface doesn't inherit any properties.</em></p>

<dl>
	<dt>{{domxref("RTCSessionDescription.type")}} {{ReadOnlyInline}}</dt>
	<dd>An enum of type <code>{{anch("RTCSdpType")}}</code> describing the session description's type.</dd>
</dl>

<dl>
	<dt>{{domxref("RTCSessionDescription.sdp")}} {{ReadOnlyInline}}</dt>
	<dd>A {{domxref("DOMString")}} containing the {{Glossary("SDP")}} describing the session.</dd>
</dl>

<h2 id="Constants">Constants</h2>

<h3 id="RTCSdpType">RTCSdpType</h3>

<p>This enum defines strings that describe the current state of the session description, as used in the {{domxref("RTCSessionDescription.type", "type")}} property. The session description's type will be specified using one of these values.</p>

<table class="standard-table">
	<thead>
		<tr>
			<th scope="col">Value</th>
			<th scope="col">Description</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td><code>answer</code></td>
			<td>The SDP contained in the {{domxref("RTCSessionDescription.sdp", "sdp")}} property is the definitive choice in the exchange. In other words, this session description describes the agreed-upon configuration, and is being sent to finalize negotiation.</td>
		</tr>
		<tr>
			<td><code>offer</code></td>
			<td>The session description object describes the initial proposal in an offer/answer exchange. The session negotiation process begins with an offer being sent from the caller to the callee.</td>
		</tr>
		<tr>
			<td><code>pranswer</code></td>
			<td>The session description object describes a provisional answer; that is, a response to a previous offer that is not the final answer. It is usually employed by legacy hardware.</td>
		</tr>
		<tr>
			<td><code>rollback</code></td>
			<td>This special type with an empty session description is used to roll back to the previous stable state.</td>
		</tr>
	</tbody>
</table>

<h2 id="Methods">Methods</h2>

<p><em>The <code>RTCSessionDescription</code> doesn't inherit any methods.</em></p>

<dl>
	<dt>{{domxref("RTCSessionDescription.RTCSessionDescription", "RTCSessionDescription()")}} {{deprecated_inline}}</dt>
	<dd>This constructor returns a new <code>RTCSessionDescription</code>. The parameter is a <code>RTCSessionDescriptionInit</code> dictionary containing the values to assign the two properties.</dd>
	<dt>{{domxref("RTCSessionDescription.toJSON()")}}</dt>
	<dd>Returns a {{Glossary("JSON")}} description of the object. The values of both properties, {{domxref("RTCSessionDescription.type", "type")}} and {{domxref("RTCSessionDescription.sdp", "sdp")}}, are contained in the generated JSON.</dd>
</dl>

<h2 id="Example">Example<span id="cke_bm_72C" style="display: none;"> </span></h2>

<pre class="brush: js">signalingChannel.onmessage = function (evt) {
    if (!pc)
        start(false);

    var message = JSON.parse(evt.data);
    if (message.sdp)
        pc.setRemoteDescription(new RTCSessionDescription(message), function () {
            // if we received an offer, we need to answer
            if (pc.remoteDescription.type == "offer")
                pc.createAnswer(localDescCreated, logError);
        }, logError);
    else
        pc.addIceCandidate(new RTCIceCandidate(message.candidate),
            function () {}, logError);
};
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
	<tbody>
		<tr>
			<th scope="col">Specification</th>
			<th scope="col">Status</th>
			<th scope="col">Comment</th>
		</tr>
		<tr>
			<td>{{ SpecName('WebRTC 1.0', '#rtcsessiondescription-class', 'RTCSessionDescription') }}</td>
			<td>{{Spec2('WebRTC 1.0')}}</td>
			<td>Initial definition.</td>
		</tr>
	</tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>



<p>{{Compat("api.RTCSessionDescription")}}</p>

<h2 id="See_also">See also</h2>

<ul>
	<li><a href="/en-US/docs/Web/Guide/API/WebRTC" title="/en-US/docs/CSS/Using_CSS_animations">WebRTC</a></li>
	<li>{{domxref("RTCPeerConnection.setLocalDescription()")}} and {{domxref("RTCPeerConnection.setRemoteDescription()")}}</li>
</ul>