A-letubby
A-letubby

Reputation: 9152

How to do network tracking or debugging WebRTC peer-to-peer connection

I am wondering that there is the tool or any method I can see what underlying WebRTC peer-to-peer connection?

For simple example, if I am implementing video chat using webrtc, all connection (offer, answer, ice) are established but I can't see the video streaming, how can I debug and see that there is any packet or something sending between these two peers or not.

Upvotes: 55

Views: 55625

Answers (3)

Anirban
Anirban

Reputation: 343

There are ways to debug underlying connection status. If you are using a web application, you can navigate to browser statistics. For chrome, chrome://webrtc-internals (API structure). This thread can be helpful too(using peerJs). For firefox, browse to about:webrtc.

For native applications, i.e for windows you have take the log from compiler itself. In MS Visual Studio 2015, try Debug > Attach Process > your native application PID, Debug>windows>output.

Upvotes: 18

Vasu
Vasu

Reputation: 1130

There could be a few reasons for video not streaming.

  1. Is your stun server responding? To check this, log the ice candidates you receicve in a console. and then check their type. if your stun server is responding then you would see the type srflx rather than just "host" type ice candidates. You can also look for them in chrome://webrtc-internals.

  2. Are you attaching the correct src blob to the video element once onaddstream is called back by the RTCPeerConnection object?

  3. You have to call the .play() method on the video element explicitly from your javascript to start the remote video stream.

Upvotes: 2

tomtheengineer
tomtheengineer

Reputation: 4287

If you're using Chrome, you can navigate to chrome://webrtc-internals. This will show you the offer, answer, ICE states, and statistics about the connection (once it has been established).

For more in-depth debugging, you can see logs of all the STUN pings between candidates by starting Chrome with the following flags:

--enable-logging --v=4

The logs will be in the chrome_debug.log file in your user data directory: http://dev.chromium.org/user-experience/user-data-directory

Upvotes: 63

Related Questions