@@ -421,18 +421,90 @@ public enum RTCDataChannelState
421421 Closed
422422 }
423423
424+
424425 /// <summary>
425- ///
426+ /// The RTCSessionDescription interface represents the setup of one side of a connection or a proposed connection.
427+ /// It contains a description type that identifies the negotiation stage it pertains to, along with the session's SDP (Session Description Protocol)
428+ /// details.
426429 /// </summary>
430+ /// <remarks>
431+ /// Establishing a connection between two parties involves swapping RTCSessionDescription objects,
432+ /// with each one proposing a set of connection setup options that the sender can accommodate.
433+ /// The connection setup is finalized when both parties agree on a particular configuration.
434+ /// </remarks>
435+ /// <example>
436+ /// <code lang="cs"><![CDATA[
437+ /// using System.Collections;
438+ /// using System.Collections.Generic;
439+ /// using System.Linq;
440+ /// using UnityEngine;
441+ /// using Unity.WebRTC;
442+ ///
443+ /// class MediaStreamer : MonoBehaviour
444+ /// {
445+ /// private RTCPeerConnection _pc1;
446+ /// private List<RTCRtpSender> pc1Senders;
447+ /// private MediaStream videoStream;
448+ /// private MediaStreamTrack track;
449+ /// private DelegateOnNegotiationNeeded pc1OnNegotiationNeeded;
450+ /// private bool videoUpdateStarted;
451+ ///
452+ /// private void Start()
453+ /// {
454+ /// pc1Senders = new List<RTCRtpSender>();
455+ /// pc1OnNegotiationNeeded = () => { StartCoroutine(PcOnNegotiationNeeded(_pc1)); };
456+ /// Call();
457+ /// }
458+ ///
459+ /// IEnumerator PcOnNegotiationNeeded(RTCPeerConnection pc)
460+ /// {
461+ /// var op = pc.CreateOffer();
462+ /// yield return op;
463+ /// if (!op.IsError)
464+ /// {
465+ /// yield return StartCoroutine(OnCreateOfferSuccess(pc, op.Desc));
466+ /// }
467+ /// }
468+ ///
469+ /// private void Call()
470+ /// {
471+ /// RTCConfiguration configuration = default;
472+ /// configuration.iceServers = new[] { new RTCIceServer { urls = new[] { "stun:stun.l.google.com:19302" } } };
473+ /// _pc1 = new RTCPeerConnection(ref configuration);
474+ /// _pc1.OnNegotiationNeeded = pc1OnNegotiationNeeded;
475+ ///
476+ /// videoStream = Camera.main.CaptureStream(1280, 720);
477+ /// track = videoStream.GetTracks().First();
478+ ///
479+ /// pc1Senders.Add(_pc1.AddTrack(track));
480+ /// if (!videoUpdateStarted)
481+ /// {
482+ /// StartCoroutine(WebRTC.Update());
483+ /// videoUpdateStarted = true;
484+ /// }
485+ /// }
486+ ///
487+ /// private IEnumerator OnCreateOfferSuccess(RTCPeerConnection pc, RTCSessionDescription desc)
488+ /// {
489+ /// Debug.Log($"Offer created. SDP is: \n{desc.sdp}");
490+ /// var op = pc.SetLocalDescription(ref desc);
491+ /// yield return op;
492+ /// }
493+ /// }
494+ ///
495+ /// ]]></code>
496+ /// </example>
497+ /// <seealso cref="RTCPeerConnection"/>
498+ /// <seealso cref="RTCRtpSender"/>
427499 public struct RTCSessionDescription
428500 {
429501 /// <summary>
430- ///
502+ /// An enum that specifies the type of the session description. Refer to <see cref="RTCSdpType"/>.
431503 /// </summary>
432504 public RTCSdpType type ;
433505
434506 /// <summary>
435- ///
507+ /// A string that holds the session's SDP information.
436508 /// </summary>
437509 [ MarshalAs ( UnmanagedType . LPStr ) ]
438510 public string sdp ;
0 commit comments