Beispiel #1
0
        public void SendLocalIceCandidateRemovals(IceCandidate[] candidates)
        {
            _executor.Execute(() =>
            {
                var json = SignalingMessage.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);
                }
            });
        }
        public void SendLocalIceCandidateRemovals(IceCandidate[] _candidates)
        {
            executor.Execute(async() =>
            {
                var json = SignalingMessage.CreateJson(_candidates);

                if (isInitiator)
                {
                    if (App.HubConnection.State != HubConnectionState.Connected)//(State != ConnectionState.Connected)
                    {
                        ReportError("Sending ICE candidate removals in non connected state.");
                        return;
                    }

                    //SendPostMessage(MessageType.Message, _messageUrl, json);
                    //TODO: SignalR Send message to Remove Ice Candidates as Initiator
                    var isIceRemoved = await App.HubConnection.InvokeAsync <string>("RemoveIceCandidates", json);
                    logger.Info(TAG, $"{isIceRemoved}");
                    if (roomConnectionParameters.IsLoopback)
                    {
                        signalingEvents.OnRemoteIceCandidatesRemoved(_candidates);
                    }
                }
                else
                {
                    //_wsClient.Send(json);
                    //TODO: SignalR Send message to Remove Ice Candidates as Participant
                    var isIceRemoved = await App.HubConnection.InvokeAsync <string>("RemoveIceCandidates", json);
                    logger.Info(TAG, $"{isIceRemoved}");
                    if (roomConnectionParameters.IsLoopback)
                    {
                        signalingEvents.OnRemoteIceCandidatesRemoved(_candidates);
                    }
                }
            });
        }