--- title: RTCSessionDescription slug: Web/API/RTCSessionDescription tags: - API - Audio - Experimental - Interface - Media - RTCSessionDescription - Reference - Video - Web - WebRTC translation_of: Web/API/RTCSessionDescription --- <p>{{APIRef("WebRTC")}}{{SeeCompatTable}}</p> <p> <strong><code>RTCSessionDescription</code></strong> インターフェイスは、接続 (または接続する予定のもの) の一端と、その構成方法を記述します。それぞれの <strong><code>RTCSessionDescription</code></strong> は、どのオファー/アンサー交渉プロセスを使用するかを表す記述の {{domxref("RTCSessionDescription.type", "type")}} と、セッションの {{Glossary("SDP")}} 記述子から成ります。</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" name="Properties">プロパティ</h2> <p><em><code>RTCSessionDescription</code> が継承するプロパティは存在しません。</em></p> <dl> <dt>{{domxref("RTCSessionDescription.type")}} {{ReadOnlyInline}}</dt> <dd>これは <code>RTCSdpType</code> の列挙型であり、ディスクリプションの種類を表します。</dd> </dl> <dl> <dt>{{domxref("RTCSessionDescription.sdp")}} {{ReadOnlyInline}}</dt> <dd>これは、セッションを説明するための {{Glossary("SDP")}} 形式の {{domxref("DOMString")}} です。</dd> </dl> <h2 id="Constants" name="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">値</th> <th scope="col">説明</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, it's a response to a previous offer or provisional answer.</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" name="Methods">メソッド</h2> <p><em><code>RTCSessionDescription</code> が継承するメソッドは存在しません。</em></p> <dl> <dt>{{domxref("RTCSessionDescription.RTCSessionDescription", "RTCSessionDescription()")}} {{deprecated_inline}}</dt> <dd>新しい <code>RTCSessionDescription</code> を返します。この引数は <code>RTCSessionDescriptionInit</code> ディクショナリであり (任意の) 2つの引数を含みます。これらの引数の1つまたは全て与えられなかった場合、関連するプロパティはnullに設定されます。</dd> <dt>{{domxref("RTCSessionDescription.toJSON()")}}</dt> <dd>このオブジェクトの {{Glossary("JSON")}} による表現を生成して返します。生成された JSON は、{{domxref("RTCSessionDescription.type", "type")}} と {{domxref("RTCSessionDescription.sdp", "sdp")}}を含みます。</dd> </dl> <h2 id="Example" name="Example">例</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 (pc.remoteDescription.type == "offer") pc.createAnswer(localDescCreated, logError); }, logError); else pc.addIceCandidate(new RTCIceCandidate(message.candidate), function () {}, logError); }; </pre> <h2 id="Specifications" name="Specifications">仕様策定状況</h2> <table class="standard-table"> <thead> <tr> <th scope="col">仕様書</th> <th scope="col">策定状況</th> <th scope="col">コメント</th> </tr> </thead> <tbody> <tr> <td>{{ SpecName('WebRTC 1.0', '#rtcsessiondescription-class', 'RTCSessionDescription') }}</td> <td>{{Spec2('WebRTC 1.0')}}</td> <td>初回定義</td> </tr> </tbody> </table> <h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> <p>{{Compat("api.RTCSessionDescription")}}</p> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li><a href="/ja/docs/Web/Guide/API/WebRTC">WebRTC</a></li> <li>{{domxref("RTCPeerConnection.setLocalDescription()")}} 及び {{domxref("RTCPeerConnection.setRemoteDescription()")}}</li> </ul>