Exemplo n.º 1
0
        public RTCSetSessionDescriptionAsyncOperation SetLocalDescription()
        {
            var      op    = new RTCSetSessionDescriptionAsyncOperation(this);
            RTCError error = WebRTC.Context.PeerConnectionSetLocalDescription(GetSelfOrThrow());

            if (error.errorType == RTCErrorType.None)
            {
                return(op);
            }
            throw new RTCErrorException(ref error);
        }
        /// <summary>
        /// This method changes the session description
        /// of the remote connection to negotiate with local connections.
        /// </summary>
        /// <param name="desc"></param>
        /// <returns>
        /// An AsyncOperation which resolves with an <see cref="RTCSessionDescription"/>
        /// object providing a description of the session.
        /// </returns>
        /// <exception cref="ArgumentException">
        /// Thrown when an argument has an invalid value.
        /// For example, when passed the sdp which is null or empty.
        /// </exception>
        /// <exception cref="RTCErrorException">
        /// Thrown when an argument has an invalid value.
        /// For example, when passed the sdp which is not be able to parse.
        /// </exception>
        /// <seealso cref="RemoteDescription"/>
        public RTCSetSessionDescriptionAsyncOperation SetRemoteDescription(
            ref RTCSessionDescription desc)
        {
            if (string.IsNullOrEmpty(desc.sdp))
            {
                throw new ArgumentException("sdp is null or empty");
            }

            var      op    = new RTCSetSessionDescriptionAsyncOperation(this);
            RTCError error = WebRTC.Context.PeerConnectionSetRemoteDescription(
                GetSelfOrThrow(), ref desc);

            if (error.errorType == RTCErrorType.None)
            {
                return(op);
            }
            throw new RTCErrorException(ref error);
        }