2

I have built a video chat app with the help of WebRTC, it is working fine.

But, I want the user to know if he has any problems sending his mediastream, I want to inform him that his network is blocking the port required for media streaming, how do I do that?

i have done some more research and found that real-time ports ( RTP ) is first opened, then UDp packets are exchanged, is there any way for the client to detect some error that might occur in this part?

0

1 Answer 1

2

Port status and opening is done via the ICE client communicating with the ICE servers. If no good link can be made(ICE assures of this), then the Ice Connection state will change to failed in the RTCPeerConnection.

To see what ports are to be opened and working, you can look in the SDP that is exchanged between the parties.

EDIT:

To see the ports opened due to the candidates, you will have to parse the candidates lines. Generally, you will only be using UDP candidates.

Here is an example candidate.

a=candidate:1204296370 1 udp 2122260223 192.168.0.13 49353 typ host generation 0

Candidates are of the form

a=candidate:<ID> <component Type> <transport type> <priority ranking> <ip address> <port> <type>

You can also grab initially supported ports that are grabbed locally in the media lines(I added :

m=audio<media> 49353<port> RTP/SAVPF<proto> 111 103 104 0 8 106 105 13 126 <rtpformats>

Here is more on how to parse through WebRTC SDPs

6
  • hi @benjamin , i looked into the sdp, it was not of much help, is there documentation somewhere , where i can get how to get ice connection details from sdp, my sdp looks something like below, of which i can neither make head or tail ` v=0 o=- 4231949088228140638 2 IN IP4 127.0.0.1 s=- t=0 0 ... `
    – mido
    Commented Sep 11, 2014 at 8:29
  • @mido22, please see updated answer. I added some SDP pointers. Commented Sep 11, 2014 at 12:57
  • thanks a lot for the update mate, makes everything crystal clear, just one doubt, is there any way we can simulate ICE server failure or inabliltiy to open ports, because I want to know response I would get if these failures occur ( so I can notify client of the problem). Thanks again.
    – mido
    Commented Sep 12, 2014 at 2:57
  • @mido22 Hmmm....I am not sure, that would be a different question that I would be curious about its answer :) Commented Sep 12, 2014 at 12:27
  • 1
    @mido22 Generally, ice candidates are sent separate of the SDP(called, ICE Trickling, and it is done through your signalling server). However, I bet you can wait until a null candidate appears in your ice candidate event handler and then send the SDP and it will contain the candidate info. Commented Mar 10, 2015 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.