Namespace: SpawnDev.SpawnJS.JSObjects.WebRTC
Inheritance: SpawnJSObject -> RTCSessionDescription
MDN Reference: RTCSessionDescription
The
RTCSessionDescriptionclass represents an SDP (Session Description Protocol) description of a WebRTC session. It contains the type of description (offer, answer, pranswer, rollback) and the SDP string itself. Used withRTCPeerConnection.SetLocalDescription()andRTCPeerConnection.SetRemoteDescription().
| Signature | Description |
|---|---|
RTCSessionDescription(SpawnJSObjectReference _ref) |
Deserialization constructor. |
| Property | Type | Description |
|---|---|---|
Type |
string |
The type of description: "offer", "answer", "pranswer", or "rollback". |
Sdp |
string |
The SDP string describing the session. |
// Create an offer
using var offer = await pc.CreateOffer();
Console.WriteLine($"Type: {offer.Type}"); // "offer"
Console.WriteLine($"SDP:\n{offer.Sdp}");
await pc.SetLocalDescription(offer);
// Set a remote description received from signaling
await pc.SetRemoteDescription(new RTCSessionDescription
{
Type = "answer",
Sdp = receivedSdpString
});