Expose errors in apprtc demo to div. Currently the errors only show in the console, the CL attempts to expose critical errors on to the div element.
BUG=2786 R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7539005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5443 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
776d8df25f
commit
ecc96af15b
@ -114,12 +114,9 @@ function onTurnResult() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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();
|
||||
messageError('No TURN server; unlikely that media will traverse networks. '
|
||||
+ 'If this persists please report it to '
|
||||
+ 'discuss-webrtc@googlegroups.com.');
|
||||
}
|
||||
// If TURN request failed, continue the call with default STUN.
|
||||
turnDone = true;
|
||||
@ -144,7 +141,7 @@ function doGetUserMedia() {
|
||||
' \'' + JSON.stringify(mediaConstraints) + '\'');
|
||||
} catch (e) {
|
||||
alert('getUserMedia() failed. Is this a WebRTC capable browser?');
|
||||
console.log('getUserMedia failed with exception: ' + e.message);
|
||||
messageError('getUserMedia failed with exception: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +154,7 @@ function createPeerConnection() {
|
||||
' config: \'' + JSON.stringify(pcConfig) + '\';\n' +
|
||||
' constraints: \'' + JSON.stringify(pcConstraints) + '\'.');
|
||||
} catch (e) {
|
||||
console.log('Failed to create PeerConnection, exception: ' + e.message);
|
||||
messageError('Failed to create PeerConnection, exception: ' + e.message);
|
||||
alert('Cannot create RTCPeerConnection object; \
|
||||
WebRTC is not supported by this browser.');
|
||||
return;
|
||||
@ -265,7 +262,7 @@ function sendMessage(message) {
|
||||
|
||||
function processSignalingMessage(message) {
|
||||
if (!started) {
|
||||
console.log('peerConnection has not been created yet!');
|
||||
messageError('peerConnection has not been created yet!');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -289,6 +286,7 @@ function onChannelOpened() {
|
||||
channelReady = true;
|
||||
maybeStart();
|
||||
}
|
||||
|
||||
function onChannelMessage(message) {
|
||||
console.log('S->C: ' + message.data);
|
||||
var msg = JSON.parse(message.data);
|
||||
@ -310,13 +308,21 @@ function onChannelMessage(message) {
|
||||
processSignalingMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
function onChannelError() {
|
||||
console.log('Channel error.');
|
||||
messageError('Channel error.');
|
||||
}
|
||||
|
||||
function onChannelClosed() {
|
||||
console.log('Channel closed.');
|
||||
}
|
||||
|
||||
function messageError(msg) {
|
||||
console.log(msg);
|
||||
infoDivErrors.push(msg);
|
||||
updateInfoDiv();
|
||||
}
|
||||
|
||||
function onUserMediaSuccess(stream) {
|
||||
console.log('User has granted access to local media.');
|
||||
// Call the polyfill wrapper to attach the media stream to this element.
|
||||
@ -328,17 +334,17 @@ function onUserMediaSuccess(stream) {
|
||||
}
|
||||
|
||||
function onUserMediaError(error) {
|
||||
var msg = 'Failed to get access to local media. Error code was ' +
|
||||
error.code + '. Continuing without sending a stream.';
|
||||
console.log(msg);
|
||||
alert(msg);
|
||||
messageError('Failed to get access to local media. Error code was ' +
|
||||
error.code + '. Continuing without sending a stream.');
|
||||
alert('Failed to get access to local media. Error code was ' +
|
||||
error.code + '. Continuing without sending a stream.');
|
||||
|
||||
hasLocalStream = false;
|
||||
maybeStart();
|
||||
}
|
||||
|
||||
function onCreateSessionDescriptionError(error) {
|
||||
console.log('Failed to create session description: ' + error.toString());
|
||||
messageError('Failed to create session description: ' + error.toString());
|
||||
}
|
||||
|
||||
function onSetSessionDescriptionSuccess() {
|
||||
@ -346,7 +352,7 @@ function onSetSessionDescriptionSuccess() {
|
||||
}
|
||||
|
||||
function onSetSessionDescriptionError(error) {
|
||||
console.log('Failed to set session description: ' + error.toString());
|
||||
messageError('Failed to set session description: ' + error.toString());
|
||||
}
|
||||
|
||||
function iceCandidateType(candidateSDP) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user