Esempio n. 1
0
        public IActionResult AddIceCandidate(string id, [FromBody] RTCIceCandidateInit iceCandidate)
        {
            _logger.LogDebug($"SetIceCandidate {id} {iceCandidate?.candidate}.");

            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest("The id cannot be empty in AddIceCandidate."));
            }
            else if (string.IsNullOrWhiteSpace(iceCandidate?.candidate))
            {
                return(BadRequest("The candidate field cannot be empty in AddIceCandidate."));
            }

            // TODO: Handle .local addresses.
            if (iceCandidate.candidate.Contains(".local"))
            {
                _logger.LogWarning("ICE candidates with .local addresses are currently not supported, coming soon.");
            }
            else
            {
                _webRTCServer.AddIceCandidate(id, iceCandidate);
            }

            return(Ok());
        }
Esempio n. 2
0
        public IActionResult AddIceCandidate(string id, [FromBody] RTCIceCandidateInit iceCandidate)
        {
            _logger.LogDebug($"SetIceCandidate {id} {iceCandidate?.candidate}.");

            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest("The id cannot be empty in AddIceCandidate."));
            }
            else if (string.IsNullOrWhiteSpace(iceCandidate?.candidate))
            {
                return(BadRequest("The candidate field cannot be empty in AddIceCandidate."));
            }

            _webRTCServer.AddIceCandidate(id, iceCandidate);

            return(Ok());
        }