WebRTC, Ice Candidate Connection

I'm trying to learn how to use webRTC in applications, so I wrote a code sample, available at the following link: http://wklej.org/hash/fd599a32e8e/

In the beginning I need to say that I do not care about browser compatibility. All I need to do is support the Chromium web engine without any external adapters / other libraries.

The web application should allow me to establish a connection between two browser tabs running on the same host - by manually exchanging the relevant data ( SDP and ICE ).

Stages:

  • Click the "Create Offer" button, copy the local SDP;
  • Switch to another tab and paste the previously copied SDP into the "remote SDP" area, then click "create response";
  • Copy the generated local SDP, go to the first tab, paste into the "remote SDP" area and click the "install remote sdp" button (do not create a response button);
  • Register ice candidates - copy them from one tab, paste into the second and click the "AddCandidates" button. Do the same thing differently.

The main problem is that this function:

peer.iceconnectionstatechange = function(event) {
    console.log("ice connection state: " + peer.iceConnectionState)
}

will not start. I tried to play with STUN / TURN servers without success. Remote video will not work. If anyone can indicate where I was wrong?

+2
source share
1 answer

(cut'n'paste): https://jsfiddle.net/7vv2vxtt/

(localStorage): https://jsfiddle.net/2v1Lnpmx/

This code intentionally left blank.

ICE / , SDP .

.

+2

Source: https://habr.com/ru/post/1666167/


All Articles