Exemple #1
0
        private async void Signaler_OnMessage(Signaler.Message message)
        {
            switch (message.MessageType)
            {
            case Signaler.Message.WireMessageType.Offer:
                await _nativePeer.SetRemoteDescriptionAsync("offer", message.Data);

                // If we get an offer, we immediately send an answer back
                _nativePeer.CreateAnswer();
                break;

            case Signaler.Message.WireMessageType.Answer:
                _ = _nativePeer.SetRemoteDescriptionAsync("answer", message.Data);
                break;

            case Signaler.Message.WireMessageType.Ice:
                // TODO - This is NodeDSS-specific
                // this "parts" protocol is defined above, in OnIceCandiateReadyToSend listener
                var parts = message.Data.Split(new string[] { message.IceDataSeparator }, StringSplitOptions.RemoveEmptyEntries);
                // Note the inverted arguments; candidate is last here, but first in OnIceCandiateReadyToSend
                _nativePeer.AddIceCandidate(parts[2], int.Parse(parts[1]), parts[0]);
                break;

            default:
                throw new InvalidOperationException($"Unhandled signaler message type '{message.MessageType}'");
            }
        }
Exemple #2
0
        private void Signaler_LocalSdpReadyToSend(string type, string sdp)
        {
            if (Signaler.SupportsRawMessages)
            {
                switch (Signaler.Message.WireMessageTypeFromString(type))
                {
                case Signaler.Message.WireMessageType.Offer:
                    Signaler.OnSdpOfferReadyToSend(sdp);
                    break;

                case Signaler.Message.WireMessageType.Answer:
                    Signaler.OnSdpOfferReadyToSend(sdp);
                    break;
                }
            }
            else
            {
                var message = new Signaler.Message
                {
                    MessageType = Signaler.Message.WireMessageTypeFromString(type),
                    Data        = sdp
                };
                Signaler.SendMessageAsync(message);
            }
        }
        private void Signaler_LocalSdpReadyToSend(string type, string sdp)
        {
            var message = new Signaler.Message
            {
                MessageType = Signaler.Message.WireMessageTypeFromString(type),
                Data        = sdp
            };

            Signaler.SendMessageAsync(message);
        }
        private void Signaler_IceCandidateReadytoSend(string candidate, int sdpMlineindex, string sdpMid)
        {
            var message = new Signaler.Message
            {
                MessageType      = Signaler.Message.WireMessageType.Ice,
                Data             = $"{candidate}|{sdpMlineindex}|{sdpMid}",
                IceDataSeparator = "|"
            };

            Signaler.SendMessageAsync(message);
        }
Exemple #5
0
 private void Signaler_IceCandidateReadytoSend(string candidate, int sdpMlineindex, string sdpMid)
 {
     if (Signaler.SupportsRawMessages)
     {
         Signaler.OnIceCandiateReadyToSend(candidate, sdpMlineindex, sdpMid);
     }
     else
     {
         var message = new Signaler.Message
         {
             MessageType      = Signaler.Message.WireMessageType.Ice,
             Data             = $"{candidate}|{sdpMlineindex}|{sdpMid}",
             IceDataSeparator = "|"
         };
         Signaler.SendMessageAsync(message);
     }
 }