docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Delegate DelegateOnNegotiationNeeded

    Delegate to be called when negotiation of the connection through the signaling channel is required.

    Namespace: Unity.WebRTC
    Assembly: Unity.WebRTC.dll
    Syntax
    public delegate void DelegateOnNegotiationNeeded()
    Remarks

    This delegate is called when negotiation of the connection through the signaling channel is required.

    Examples
    peerConnection.OnNegotiationNeeded = () =>
    {
        StartCoroutine(NegotiationProcess());
    }
    
    IEnumerator NegotiationProcess()
    {
        RTCSessionDescriptionAsyncOperation asyncOperation = peerConnection.CreateOffer();
        yield return asyncOperation;
    
        if (!asyncOperation.IsError)
        {
            RTCSessionDescription description = asyncOperation.Desc;
            RTCSetSessionDescriptionAsyncOperation asyncOperation = peerConnection.SetLocalDescription(ref description);
            yield return asyncOperation;
        }
    }
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)