/// <summary>
        /// Creates a new data channel related the remote peer.
        /// </summary>
        /// <param name="label"> A string for the data channel.
        /// This string may be checked by <see cref="RTCDataChannel.Label"/>. </param>
        /// <param name="options"> A struct provides configuration options for the data channel. </param>
        /// <returns> A new data channel. </returns>
        public RTCDataChannel CreateDataChannel(string label, RTCDataChannelInit options = null)
        {
            RTCDataChannelInitInternal _options =
                options == null ? new RTCDataChannelInitInternal() : (RTCDataChannelInitInternal)options;

            IntPtr ptr = WebRTC.Context.CreateDataChannel(GetSelfOrThrow(), label, ref _options);

            if (ptr == IntPtr.Zero)
            {
                throw new ArgumentException("RTCDataChannelInit object is incorrect.");
            }
            return(new RTCDataChannel(ptr, this));
        }
Beispiel #2
0
 public static extern IntPtr ContextCreateDataChannel(IntPtr ptr, IntPtr ptrPeer, [MarshalAs(UnmanagedType.LPStr, SizeConst = 256)] string label, ref RTCDataChannelInit options);
Beispiel #3
0
 public IntPtr CreateDataChannel(IntPtr ptr, string label, ref RTCDataChannelInit options)
 {
     return(NativeMethods.ContextCreateDataChannel(self, ptr, label, ref options));
 }