ICE failed, see about:webrtc for more details

3,383 views
Skip to first unread message

Pardeep Beniwal

unread,
Jul 15, 2015, 9:27:57 AM7/15/15
to discuss...@googlegroups.com
I am making peer to peer connection for voice calling. I have call offer to other user and he receive call and connection establish successfully. After that I am getting error - 'ICE failed, see about:webrtc for more details'
Please help me what is problem in my code:

client side javascript:


if (!console || !console.log) {
  var console = {
    log: function() {}
  };
}

// Ugh, globals.
var isFirefox = !!navigator.mozGetUserMedia;
var isChrome = !!navigator.webkitGetUserMedia;
var STUN = {
        url: isChrome ? 'stun:stun.l.google.com:19302' : 'stun:23.21.150.121'
    };

    var TURN = {
        url: 'turn:numb.viagenie.ca',
        credential: 'muazkh'
    };

    var iceServers = {
        iceServers: [STUN]
    };

    if (isChrome) {
        if (parseInt(navigator.userAgent.match( /Chrom(e|ium)\/([0-9]+)\./ )[2]) >= 28)
            TURN = {
                url: 'turn:numb.viagenie.ca',
                credential: 'muazkh',
                username: 'web...@live.com'
            };

        iceServers.iceServers = [STUN, TURN];
    }

var options = {
    optional: [
        {DtlsSrtpKeyAgreement: true},
        //{RtpDataChannels: true}
    ]
};
var SIGNALING_SERVER = 'http://192.168.1.105:5000/';
navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
var PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;

var RTCSessionDescription = window.mozRTCSessionDescription || window.RTCSessionDescription || window.webkitRTCPeerConnection;;
var RTCIceCandidate = window.mozRTCIceCandidate || window.RTCIceCandidate;


var peerc;
var source = new EventSource("events");


$("#incomingCall").modal();
$("#incomingCall").modal("hide");

$("#incomingCall").on("hidden", function() {
  document.getElementById("incomingRing").pause();
});

source.addEventListener("ping", function(e) {}, false);

source.addEventListener("userjoined", function(e) {
  appendUser(e.data);
}, false);

source.addEventListener("userleft", function(e) {
  removeUser(e.data);
}, false);

source.addEventListener("offer", function(e) {
  var offer = JSON.parse(e.data);
  document.getElementById("incomingUser").innerHTML = offer.from;
  document.getElementById("incomingAccept").onclick = function() {
    $("#incomingCall").modal("hide");
    acceptCall(offer);
  };
  $("#incomingCall").modal();
  document.getElementById("incomingRing").play();
}, false);

source.addEventListener("answer", function(e) {
  var answer = JSON.parse(e.data);
  peerc.setRemoteDescription(new RTCSessionDescription(JSON.parse(answer.answer)), function() {
    console.log("Call established!");
  }, error);
}, false);

function log(info) {
  var d = document.getElementById("debug");
  d.innerHTML += info + "\n\n";
}

function appendUser(user) {
  // If user already exists, ignore it
  var index = users.indexOf(user);
  if (index > -1)
    return;

  users.push(user);
  console.log("appendUser: user = " + user + "users.length = " + users.length);
  

  var d = document.createElement("div");
  d.setAttribute("id", btoa(user));

  var a = document.createElement("a");
  a.setAttribute("class", "btn btn-block btn-inverse");
  a.setAttribute("onclick", "initiateCall('" + user + "');");
  a.innerHTML = "<i class='icon-user icon-white'></i> " + user;

  d.appendChild(a);
  d.appendChild(document.createElement("br"));
  document.getElementById("users").appendChild(d);
}

function removeUser(user) {
  // If user already exists, ignore it
  var index = users.indexOf(user);
  if (index == -1)
    return;

  users.splice(index, 1)

  var d = document.getElementById(btoa(user));
  if (d) {
    document.getElementById("users").removeChild(d);
  }
}

// TODO: refactor, this function is almost identical to initiateCall().
function acceptCall(offer) {
  log("Incoming call with offer " + offer);
  document.getElementById("main").style.display = "none";
  document.getElementById("call").style.display = "block";

  navigator.getUserMedia({video:false, audio:true}, function(stream) {
    document.getElementById("localvideo").mozSrcObject = stream;
    document.getElementById("localvideo").play();
    document.getElementById("localvideo").muted = true;

//var pc = new mozRTCPeerConnection();
var pc = new PeerConnection(iceServers, options);
    pc.addStream(stream);

    pc.onaddstream = function(obj) {
      document.getElementById("remotevideo").mozSrcObject = obj.stream;
      document.getElementById("remotevideo").play();
      document.getElementById("dialing").style.display = "none";
      document.getElementById("hangup").style.display = "block";
    };

    //pc.setRemoteDescription(new mozRTCSessionDescription(JSON.parse(offer.offer)), function() {
    pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(offer.offer)), function() {
      log("setRemoteDescription, creating answer");
      pc.createAnswer(function(answer) {
        pc.setLocalDescription(answer, function() {
          // Send answer to remote end.
          log("created Answer and setLocalDescription " + JSON.stringify(answer));
          peerc = pc;
          jQuery.post(
            "answer", {
              to: offer.from,
              from: offer.to,
              answer: JSON.stringify(answer)
            },
            function() { console.log("Answer sent!"); }
          ).error(error);
        }, error);
      }, error);
    }, error);
  }, error);
}

function initiateCall(user) {
  document.getElementById("main").style.display = "none";
  document.getElementById("call").style.display = "block";

  navigator.getUserMedia({video:false, audio:true}, function(stream) {
    document.getElementById("localvideo").mozSrcObject = stream;
    document.getElementById("localvideo").play();
    document.getElementById("localvideo").muted = true;

   // var pc = new mozRTCPeerConnection();
   var pc = new PeerConnection(iceServers, options);
    pc.addStream(stream);

    pc.onaddstream = function(obj) {
      log("Got onaddstream of type " + obj.type);
      document.getElementById("remotevideo").mozSrcObject = obj.stream;
      document.getElementById("remotevideo").play();
      document.getElementById("dialing").style.display = "none";
      document.getElementById("hangup").style.display = "block";
    };

    pc.createOffer(function(offer) {
      log("Created offer" + JSON.stringify(offer));
      pc.setLocalDescription(offer, function() {
        // Send offer to remote end.
        log("setLocalDescription, sending to remote");
        
        peerc = pc;
        jQuery.post(
          "offer", {
            to: user,
            from: document.getElementById("user").innerHTML,
            offer: JSON.stringify(offer)
          },
          function() { console.log("Offer sent!"); }
        ).error(error);
      }, error);
    }, error);
  }, error);
}

function endCall() {
  log("Ending call");
  document.getElementById("call").style.display = "none";
  document.getElementById("main").style.display = "block";

  document.getElementById("localvideo").mozSrcObject.stop();
  document.getElementById("localvideo").mozSrcObject = null;
  document.getElementById("remotevideo").mozSrcObject = null;

  peerc.close();
  peerc = null;
}

function error(e) {
  if (typeof e == typeof {}) {
    alert("Oh no! " + JSON.stringify(e));
  } else {
    alert("Oh no! " + e);
  }
  endCall();
}

var users = [];
users.push(document.getElementById("user").innerHTML);


---------------------------------
Node js server side javascript:
var express = require("express"),
    https   = require("https"),
    app     = express();

app.set("view engine", "ejs");
app.set("views", __dirname + "/views");

app.use(express.bodyParser());
app.use(express.cookieParser("thisistehsecret"));

app.use(express.session());
app.use(express.static(__dirname + "/static"));

app.get("/", function(req, res) {
  res.redirect("/login");
});

app.get("/login", function(req, res) {
  if (req.session.user) {
    res.redirect("/chat");
    return;
  }

  // ejs complains about undefined variable?
  res.locals.message = "";
  res.locals.offline = true;
  if (req.query.err) {
    res.locals.message = req.query.err;
  }
  if (process.env.ONLINE) {
    res.locals.offline = false;
  }
  res.render("login");
});

app.get("/chat", function(req, res) {
  if (!req.session.user) {
    doRedirect("Access denied, try logging in?", res);
    return;
  }
  res.locals.user = req.session.user;
  res.render("chat");
});

app.get("/events", function(req, res) {
  if (!req.session.user) {
    res.send(401, "Unauthorized, events access denied");
    return;
  }

  // Setup event channel.
  res.type("text/event-stream");
  res.write("event: ping\n");
  res.write("data: ping\n\n");

  // First notify this user of all users current.
  var keys = Object.keys(users);
  for (var i = 0; i < keys.length; i++) {
    var user = keys[i];
    res.write("event: userjoined\n");
    res.write("data: " + user + "\n\n");
  }

  // Add to current list of online users.
  users[req.session.user] = res;
});

app.post("/offer", function(req, res) {
  if (!req.session.user) {
    res.send(401, "Unauthorized, offer access denied");
    return;
  }

  if (!req.body.to || !req.body.from || !req.body.offer) {
    res.send(400, "Invalid offer request");
    return;
  }

  var channel = users[req.body.to];
  console.log(channel);
  if (!channel) {
    res.send(400, "Invalid user for offer");
    return;
  }

  channel.write("event: offer\n");
  channel.write("data: " + JSON.stringify(req.body));
  channel.write("\n\n");

  res.send(200);
});

// TODO: refactor, this is almost a duplicate of post("offer").
app.post("/answer", function(req, res) {
  if (!req.session.user) {
    res.send(401, "Unauthorized, answer access denied");
    return;
  }

  if (!req.body.to || !req.body.from || !req.body.answer) {
    res.send(400, "Invalid offer request");
    return;
  }

  var channel = users[req.body.to];
  if (!channel) {
    res.send(400, "Invalid user for answer");
    return;
  }
 
  channel.write("event: answer\n");
  channel.write("data: " + JSON.stringify(req.body));
  channel.write("\n\n");

  res.send(200);
});

app.post("/login", function(req, res) {
  if (!req.body.assertion) {
    res.send(500, "Invalid login request");
    return;
  }

  verifyAssertion(req.body.assertion, audience, function(val) {
    if (val) {
      req.session.regenerate(function() {
        req.session.user = val;
        notifyAllAbout(val);
        res.send(200);
      });
    } else {
      res.send(401, "Invalid Persona assertion");
    }
  });
});

app.post("/logout", function(req, res) {
  req.session.destroy(function(){
    res.send(200);
  });
});

var users = {};
var port = process.env.PORT || 5000;
var audience = process.env.AUDIENCE || "http://gupshup.herokuapp.com";

app.listen(port, function() {
  console.log("Port is " + port + " with audience " + audience);
});

// Helper functions.

function doRedirect(msg, res) {
  res.redirect("/login?err=" + encodeURIComponent(msg));
}

function notifyAllAbout(user) {
  var keys = Object.keys(users);
  for (var i = 0; i < keys.length; i++) {
    var channel = users[keys[i]];
    channel.write("event: userjoined\n");
    channel.write("data: " + user + "\n\n");
  }
}

function verifyAssertion(ast, aud, cb) {
  if (!process.env.ONLINE) {
    cb(ast);
    return;
  }

  var data = "audience=" + encodeURIComponent(aud);
  data += "&assertion=" + encodeURIComponent(ast);

  var options = {
    path: "/verify",
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      "Content-Length": data.length
    }
  };

  var req = https.request(options, function(res) {
    var ret = "";
    res.on("data", function(chunk) {
      ret += chunk;
    });
    res.on("end", function() {
      try {
        var val = JSON.parse(ret);
      } catch(e) {
        cb(false);
        return;
      }
      if (val.status == "okay") {
        cb(val.email);
      } else {
       // console.log(data);
        //console.log(val);
        cb(false);
      }
    });
  });

  req.write(data);
  req.end();
}

Christoffer Jansson

unread,
Jul 15, 2015, 10:26:42 AM7/15/15
to discuss...@googlegroups.com
Hi,

Please do not post full source here (code snippets are fine), use something like jsfiddle for this.

As for you problem, please provide a full trace from the code in a file and share here.

Also have you visited the about:webrtc page in Firefox to see what it says?

/Chris

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/1e615871-59c2-4063-b160-5cad7eb340d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pardeep Beniwal

unread,
Jul 16, 2015, 9:39:21 AM7/16/15
to discuss...@googlegroups.com
Please see attached file server side app.js and client side chat.js.
Please help me.
app.js
chat.js

Christoffer Jansson

unread,
Jul 17, 2015, 2:46:15 AM7/17/15
to discuss...@googlegroups.com, pardeepb...@gmail.com


On Thursday, July 16, 2015 at 3:39:21 PM UTC+2, Pardeep Beniwal wrote:
Please see attached file server side app.js and client side chat.js.
1. Could you include the full stack trace/log from the execution of the code? The best would be if you could share a working demo of you application on a web server that I could reach and try out myself.
2. Could you also include the contents of about:webrtc when the error occurs?
Please help me.
I'm trying ;). 
...

Pardeep Beniwal

unread,
Jul 17, 2015, 3:29:52 AM7/17/15
to discuss...@googlegroups.com
Hi Chris,
Thanks for reply
I don't have live working demo of my code so can I share zip file containing the code after that you can check easy

--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/uaE48zbGwPE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/ef22d328-4bb8-4690-8191-88476e646692%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--





Thanks & Regards
Pardeep Beniwal
(Software Developer)

Christoffer Jansson

unread,
Jul 17, 2015, 3:34:59 AM7/17/15
to discuss...@googlegroups.com
On Fri, Jul 17, 2015 at 9:29 AM Pardeep Beniwal <pardeepb...@gmail.com> wrote:
Hi Chris,
Thanks for reply
I don't have live working demo of my code so can I share zip file containing the code after that you can check easy
Sorry I need to see the code in action or a trace from the code in action. I will not do a static analysis of your code, there is simply not enough time to do that for everyone.

Also, please post the result of about:webrtc when you run into the issue.

/Chris
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/CANeCQH0CszXiWMu6Tq0JDE83_ZUe-%3DViBXr80%3DyjM3awU78Yiw%40mail.gmail.com.

Pardeep Beniwal

unread,
Jul 17, 2015, 4:08:34 AM7/17/15
to discuss...@googlegroups.com
I am getting error - 'ICE failed, see about:webrtc for more details' in browser after established connection both side. 


For more options, visit https://groups.google.com/d/optout.

Christoffer Jansson

unread,
Jul 17, 2015, 4:12:23 AM7/17/15
to discuss...@googlegroups.com
On Fri, Jul 17, 2015 at 10:08 AM Pardeep Beniwal <pardeepb...@gmail.com> wrote:
I am getting error - 'ICE failed, see about:webrtc for more details' in browser after established connection both side. 
Yes but I need to see the logs, e.g. what data is sent in and what data comes out, i.e. a trace from your running code.

Also could please browse to about:webrtc in a separate tab as the error suggests and add the output here? If it's huge, then in a file pls. 

Pardeep Beniwal

unread,
Jul 17, 2015, 4:23:46 AM7/17/15
to discuss...@googlegroups.com
When I load the browser console.log firfox side
appendUser: user = User2 users.length = 2

----Google Chrome Side---
appendUser: user = User2 users.length = 2 

------Send Request from User1 to User2---
Offer sent!

----Google Chrom User2 Accept the request--
setRemoteDescription, creating answer chat.js:158
created Answer and setLocalDescription {"sdp":"v=0\r\no=- 674487862142127757 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE sdparta_0\r\na=msid-semantic: WMS dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM\r\nm=audio 1 RTP/SAVPF 109 0 8\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:cmL6a5+XPyo5XrSD\r\na=ice-pwd:W5wwg8vaV8/lLocUIu9BSDOx\r\na=fingerprint:sha-256 1C:68:69:B2:F4:F2:E0:D6:D0:47:B2:09:D4:1D:FC:69:09:33:4B:BA:DB:D6:11:09:B6:B1:C0:8F:80:AB:B7:E8\r\na=setup:active\r\na=mid:sdparta_0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:109 opus/48000/2\r\na=fmtp:109 minptime=10\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=maxptime:60\r\na=ssrc:2855988900 cname:xyT6zXKhBJ9/rs3W\r\na=ssrc:2855988900 msid:dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM b81f91bd-c94f-4ee5-b4f7-12dd073090dd\r\na=ssrc:2855988900 mslabel:dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM\r\na=ssrc:2855988900 label:b81f91bd-c94f-4ee5-b4f7-12dd073090dd\r\n","type":"answer"} chat.js:163
Answer sent! 

----Firfox getting console---
Call established! chat.js (line 87)
ICE failed, see about:webrtc for more details

---Google Crome Console---
GET http://192.168.1.105:5000/events  net::ERR_INCOMPLETE_CHUNKED_ENCODING 



For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Christoffer Jansson

unread,
Jul 17, 2015, 7:32:55 AM7/17/15
to discuss...@googlegroups.com
On Fri, Jul 17, 2015 at 10:23 AM Pardeep Beniwal <pardeepb...@gmail.com> wrote:
When I load the browser console.log firfox side
appendUser: user = User2 users.length = 2

----Google Chrome Side---
appendUser: user = User2 users.length = 2 

------Send Request from User1 to User2---
Offer sent!

----Google Chrom User2 Accept the request--
setRemoteDescription, creating answer chat.js:158
created Answer and setLocalDescription {"sdp":"v=0\r\no=- 674487862142127757 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE sdparta_0\r\na=msid-semantic: WMS dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM\r\nm=audio 1 RTP/SAVPF 109 0 8\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:cmL6a5+XPyo5XrSD\r\na=ice-pwd:W5wwg8vaV8/lLocUIu9BSDOx\r\na=fingerprint:sha-256 1C:68:69:B2:F4:F2:E0:D6:D0:47:B2:09:D4:1D:FC:69:09:33:4B:BA:DB:D6:11:09:B6:B1:C0:8F:80:AB:B7:E8\r\na=setup:active\r\na=mid:sdparta_0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=rtcp-mux\r\na=rtpmap:109 opus/48000/2\r\na=fmtp:109 minptime=10\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=maxptime:60\r\na=ssrc:2855988900 cname:xyT6zXKhBJ9/rs3W\r\na=ssrc:2855988900 msid:dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM b81f91bd-c94f-4ee5-b4f7-12dd073090dd\r\na=ssrc:2855988900 mslabel:dtK1SsM1ZccuML25uvRiD9zi5B7IpuL464UM\r\na=ssrc:2855988900 label:b81f91bd-c94f-4ee5-b4f7-12dd073090dd\r\n","type":"answer"} chat.js:163
Answer sent! 

----Firfox getting console---
Call established! chat.js (line 87)
ICE failed, see about:webrtc for more details
Please provide the details from about:webrtc......  (open a separate tab in Firefox and browse to about:webrtc) 

Pardeep Beniwal

unread,
Jul 17, 2015, 8:23:31 AM7/17/15
to discuss...@googlegroups.com
Hi,
I am not able click on about:webrtc because that is not hyperlink. What should I do now ? I am very confused and I have search on google about this error but no luck.
...

Silvia Pfeiffer

unread,
Jul 17, 2015, 8:28:56 AM7/17/15
to discuss...@googlegroups.com
it's : about://webrtc-internals
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "discuss-webrtc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to discuss-webrt...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/discuss-webrtc/5e6d6e24-3c14-4385-9094-61d24bfcd4d7%40googlegroups.com.

Christoffer Jansson

unread,
Jul 17, 2015, 9:02:53 AM7/17/15
to discuss...@googlegroups.com


On Fri, Jul 17, 2015 at 2:28 PM Silvia Pfeiffer <silviap...@gmail.com> wrote:
it's :  about://webrtc-internals
This is for Chrome (chrome://webrtc-internals or about://webrtc-internals).
For Firefox you have to navigate to about:webrtc.

On Fri, Jul 17, 2015 at 10:23 PM, Pardeep Beniwal
<pardeepb...@gmail.com> wrote:
> Hi,
> I am not able click on about:webrtc because that is not hyperlink. What
> should I do now ? I am very confused and I have search on google about this
> error but no luck.
Open a tab in Firefox, copy+paste about:webrtc and hit enter.  

Pardeep Beniwal

unread,
Jul 20, 2015, 1:07:40 AM7/20/15
to discuss...@googlegroups.com
Hi, 
Thanks for response and back to my issue again
Now I am able to see ICE details:

Chrome- there are showing two link
                  




--

---
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/uaE48zbGwPE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/CAAdOTUOYgcostVxE90f7CASN%2BK256rxHR2gUjhOvY3DE9_s3bA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--





Thanks & Regards
Pardeep Beniwal
(Software Developer)

Christoffer Jansson

unread,
Jul 20, 2015, 2:38:28 AM7/20/15
to discuss...@googlegroups.com, pardeepb...@gmail.com
Have you tried to setup a call between Chrome and Chrome, Firefox to Firefox or are you mixing? In your code I can see it adds TURN url's for Chrome but not Firefox, seems odd to me. The error itself is correct, all ice candidates fail for media.

If you haven't could you try to setup a call between two Chrome browsers and then two Firefox browsers just to make sure we do not have a interop issue here?

Also check if you get proper candidates on this page http://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/, you can add the turn server here as well from your code to check that it works.

/Chris

Abhiraj Gandhi

unread,
Apr 26, 2016, 12:57:19 PM4/26/16
to discuss-webrtc
Hi Christoffer, Pradeep,

Has the issue has been resolved. If yes, could you please let me know the diagnostic steps to fix this issue.

I am also getting the same error.

about:webrtc, report is attached with this.
webrtc-result.html

Byron Campen

unread,
Apr 26, 2016, 1:19:52 PM4/26/16
to discuss...@googlegroups.com
    You either need to handle trickle ICE candidates (set up an onicecandidate callback to learn about them, signal them to the other side, and pass them to the browser with addIceCandidate), or you need to delay sending the SDP until ICE gathering is done, so it will have the full compliment of candidates in it.

Best regards,
Byron Campen
--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Abhiraj Gandhi

unread,
Apr 26, 2016, 10:29:03 PM4/26/16
to discuss-webrtc
I tried the 2nd option to delay sending the SDP until ICE gathering is done. However, no ICE events are getting generated and so the offer is also not sent.

I basically delayed the createoffer() and setLocalDescription() until ice gathering is done. Please note, I am a new bee so pardon for my ignorance.

Here are my 2 functions "initiatecall" and "send_sdp_to_remote_peer". The 2nd function is triggered based on the ICE event.

function initiateCall(user) {
  peerUser = user;

  console.log("Inside initiate call");
  document.getElementById("contentwindow").style.display = "none";
  document.getElementById("videowindow").style.display = "block";
  
  console.log("Inside initiate call 2");
   
   navigator.mozGetUserMedia({video:true}, function(vs) {
    document.getElementById("localvideo").mozSrcObject = vs;
    document.getElementById("localvideo").play();

    console.log("Success in getting local video for the call");
//navigator.mediaDevices.getUserMedia({audio:true}, function(as) {
    navigator.mozGetUserMedia({audio:true}, function(as) {
      document.getElementById("localaudio").mozSrcObject = as;
      document.getElementById("localaudio").play();

      var pc = new mozRTCPeerConnection();
      pc.addStream(vs);
      pc.addStream(as);

      pc.onicecandidate = function (evt) {
         console.log("onicecandidate event detected: " + JSON.stringify(evt.candidate));

         if (evt.candidate === null) {
            send_sdp_to_remote_peer();
         }
      };

      pc.oniceconnectionstatechange = function (event) {
         console.log("oniceconnectionstatechange event detected: " + JSON.stringify(evt.candidate));
         if (pc.iceGatheringState === 'complete') {
             send_sdp_to_remote_peer();
         }
      };

      pc.onaddstream = function(obj) {
        log("Got onaddstream of type " + obj.type);
        if (obj.type == "video") {
          document.getElementById("remotevideo").mozSrcObject = obj.stream;
          document.getElementById("remotevideo").play();
        } else {
          document.getElementById("remoteaudio").mozSrcObject = obj.stream;
          document.getElementById("remoteaudio").play();
        }
      };

      peerc = pc;
      //pc.createOffer(function(offer) {
      //   log("Created offer" + JSON.stringify(offer));
      //   console.log("Created offer" + JSON.stringify(offer));
      //  pc.setLocalDescription(offer, function() {
      //    // Send offer to remote end.
      //     log("setLocalDescription, sending to remote");
      //     //pc.iceCandidate = new RTCIceCandidate();
      //     //console.log(pc.iceCandidate);
      //    peerc = pc;
      //    jQuery.post(
      //      "offer", {
      //        to: user,
      //        from: document.getElementById("user").innerHTML,
      //        offer: JSON.stringify(offer)
      //      },
      //      function() { console.log("Offer sent!"); }
      //    ).error(error);
      //  }, error);
      //}, error);
    }, error);
  }, error);
}

function send_sdp_to_remote_peer()
{
   if (sdp_sent == false) {
      sdp_sent = true;
      peerc.createOffer(function (offer) {
         log("Created offer" + JSON.stringify(offer));
         console.log("Created offer" + JSON.stringify(offer));
         peerc.setLocalDescription(offer, function () {
            // Send offer to remote end.
            log("setLocalDescription, sending to remote");
            jQuery.post(
              "offer", {
                 to: peerUser,
                 from: document.getElementById("user").innerHTML,
                 offer: JSON.stringify(offer)
              },
              function () { console.log("Offer sent!"); }
            ).error(error);
         }, error);
      }, error);
   }
};


...

Abhiraj Gandhi

unread,
Apr 27, 2016, 4:18:19 PM4/27/16
to discuss-webrtc
I have made some progress and have made some changes as suggested by Bryan. Earlier I was doing a mistake and was creating offer once ice gathering was done, which was incorrect. Now offer is created earlier and sent only when ice gathering is done, after which I have actually made some progress. but not completely. In a 2 party call (A to B), i can see local and remote video at B user only not at the B side. And if the call is made (B to A), only local video and no audio.

Here is my observation with attached webrtc result report

call from from user "cary" to "Suhas" work. 

At "Suhas" side I can side both local and remote video, 2 way audio also.

At "cary" side, I can see only local video, NO remote video and 2 way audio is good.

Attached both side webresults;


call from from user "Suhas" to "cary" work. 

At "Suhas" side I can see local video, NO remote video,  no 2 way audio also.

At "cary" side, I can see local video, NO remote video,  no 2 way audio also.

Attached both side webresults;
...
webrtc_result.zip

Abhiraj Gandhi

unread,
Apr 28, 2016, 11:49:06 AM4/28/16
to discuss-webrtc
Waiting for feedback for the last report shared. I would appreciate if I get a response for the results shared in the last post.
...

Byron Campen

unread,
Apr 28, 2016, 12:37:30 PM4/28/16
to discuss...@googlegroups.com
    If you want to avoid trickle by waiting for gathering to complete, you need to do so on the answerer too. I would recommend implementing trickle though.

Best regards,
Byron Campen
--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages