Show the signaling state and ice connection state in AppRTC by hooking up the peerconnections .onsignalingstatechange and .oniceconnectionstatechange events.

Hopefully this will increase the quality of the "it does not work" reports from users by giving them more information about what is going on under the hood.

R=juberti@google.com

Review URL: https://webrtc-codereview.appspot.com/2174004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4718 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
braveyao@webrtc.org 2013-09-10 17:37:16 +00:00
parent 319c98d663
commit 641340944b

View File

@ -143,6 +143,8 @@ function createPeerConnection() {
}
pc.onaddstream = onRemoteStreamAdded;
pc.onremovestream = onRemoteStreamRemoved;
pc.onsignalingstatechange = onSignalingStateChanged;
pc.oniceconnectionstatechange = onIceConnectionStateChanged;
}
function maybeStart() {
@ -340,6 +342,14 @@ function onRemoteStreamRemoved(event) {
console.log('Remote stream removed.');
}
function onSignalingStateChanged(event) {
updateInfoDiv();
}
function onIceConnectionStateChanged(event) {
updateInfoDiv();
}
function onHangup() {
console.log('Hanging up.');
transitionToDone();
@ -428,6 +438,13 @@ function updateInfoDiv() {
for (var type in gatheredIceCandidateTypes[endpoint])
contents += " " + type + "\n";
}
if (pc != null) {
contents += "Gathering: " + pc.iceGatheringState + "\n";
contents += "</pre>\n";
contents += "<pre>PC State:\n";
contents += "Signaling: " + pc.signalingState + "\n";
contents += "ICE: " + pc.iceConnectionState + "\n";
}
var div = getInfoDiv();
div.innerHTML = contents + "</pre>";
}