From 0b7d8e6fcb819974315d46e033b04bbe96d206f2 Mon Sep 17 00:00:00 2001 From: "fischman@webrtc.org" Date: Mon, 6 Jan 2014 23:46:53 +0000 Subject: [PATCH] AppRTC: Alert the user to failure to acquire TURN server. Hopefully will result in quicker turnaround time for CEOD/turnserver fixes. Might trigger undesirable levels of bogus/spammy/unhelpful/PEBCAK reports to discuss-webrtc, in which case I'll remove the second part of the message. R=juberti@google.com, juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/4779005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5343 4adac7df-926f-26a2-2b94-8c16560cd09d --- samples/js/apprtc/js/main.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/samples/js/apprtc/js/main.js b/samples/js/apprtc/js/main.js index 6c261b1e1a..3c0b73ee8d 100644 --- a/samples/js/apprtc/js/main.js +++ b/samples/js/apprtc/js/main.js @@ -20,6 +20,7 @@ var isVideoMuted = false; var isAudioMuted = false; // Types of gathered ICE Candidates. var gatheredIceCandidateTypes = { Local: {}, Remote: {} }; +var infoDivErrors = []; function initialize() { if (errorMessages.length > 0) { @@ -105,7 +106,12 @@ function onTurnResult() { } } } else { - console.log('Request for TURN server failed.'); + var msg = + 'No TURN server; unlikely that media will traverse networks. ' + + 'If this persists please report it to discuss-webrtc@googlegroups.com.'; + console.log(msg); + infoDivErrors.push(msg); + updateInfoDiv(); } // If TURN request failed, continue the call with default STUN. turnDone = true; @@ -454,17 +460,29 @@ function updateInfoDiv() { } var div = getInfoDiv(); div.innerHTML = contents + ""; + + for (var msg in infoDivErrors) { + div.innerHTML += '

' + + infoDivErrors[msg] + '

'; + } + if (infoDivErrors.length) + showInfoDiv(); } -function toggleInfoDivDisplay() { +function toggleInfoDiv() { var div = getInfoDiv(); if (div.style.display == "block") { div.style.display = "none"; } else { - div.style.display = "block"; + showInfoDiv(); } } +function showInfoDiv() { + var div = getInfoDiv(); + div.style.display = "block"; +} + function toggleVideoMute() { // Call the getVideoTracks method via adapter.js. videoTracks = localStream.getVideoTracks(); @@ -533,7 +551,7 @@ document.onkeydown = function(event) { toggleVideoMute(); return false; case 73: - toggleInfoDivDisplay(); + toggleInfoDiv(); return false; default: return;