Пример #1
0
        public void SendLocalIceCandidateRemovals(IceCandidate[] candidates)
        {
            _executor.Execute(() =>
            {
                var json = ARDSignalingMessage.CreateJson(candidates);

                if (_initiator)
                {
                    if (State != ConnectionState.Connected)
                    {
                        ReportError("Sending ICE candidate removals in non connected state.");
                        return;
                    }

                    SendPostMessage(MessageType.Message, _messageUrl, json);
                    if (_connectionParameters.IsLoopback)
                    {
                        _signalingEvents.OnRemoteIceCandidatesRemoved(candidates);
                    }
                }
                else
                {
                    _wsClient.Send(json);
                }
            });
        }
Пример #2
0
        public void SendAnswerSdp(SessionDescription sdp)
        {
            _executor.Execute(() =>
            {
                if (_connectionParameters.IsLoopback)
                {
                    _logger.Error(TAG, "Sending answer in loopback mode.");
                    return;
                }

                var json = ARDSignalingMessage.CreateJson(sdp);


                _wsClient.Send(json);
            });
        }
Пример #3
0
        public void SendLocalIceCandidate(IceCandidate candidate)
        {
            _executor.Execute(() =>
            {
                var json = ARDSignalingMessage.CreateJson(candidate);
                if (_initiator)
                {
                    if (State != ConnectionState.Connected)
                    {
                        ReportError("Sending ICE candidate in non connected state.");
                        return;
                    }

                    SendPostMessage(MessageType.Message, _messageUrl, json);
                }
                else
                {
                    _wsClient.Send(json);
                }
            });
        }
Пример #4
0
        public void SendOfferSdp(SessionDescription sdp)
        {
            _executor.Execute(() =>
            {
                if (State != ConnectionState.Connected)
                {
                    ReportError("Sending offer SDP in non connected state.");
                    return;
                }

                var json = ARDSignalingMessage.CreateJson(sdp);

                SendPostMessage(MessageType.Message, _messageUrl, json);

                if (_connectionParameters.IsLoopback)
                {
                    // In loopback mode rename this offer to answer and route it back.
                    var sdpAnswer = new SessionDescription(SdpType.Answer, sdp.Sdp);
                    _signalingEvents.OnRemoteDescription(sdpAnswer);
                }
            });
        }