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 {
|
} else {
|
||||||
var msg =
|
messageError('No TURN server; unlikely that media will traverse networks. '
|
||||||
'No TURN server; unlikely that media will traverse networks. ' +
|
+ 'If this persists please report it to '
|
||||||
'If this persists please report it to discuss-webrtc@googlegroups.com.';
|
+ 'discuss-webrtc@googlegroups.com.');
|
||||||
console.log(msg);
|
|
||||||
infoDivErrors.push(msg);
|
|
||||||
updateInfoDiv();
|
|
||||||
}
|
}
|
||||||
// If TURN request failed, continue the call with default STUN.
|
// If TURN request failed, continue the call with default STUN.
|
||||||
turnDone = true;
|
turnDone = true;
|
||||||
@ -144,7 +141,7 @@ function doGetUserMedia() {
|
|||||||
' \'' + JSON.stringify(mediaConstraints) + '\'');
|
' \'' + JSON.stringify(mediaConstraints) + '\'');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert('getUserMedia() failed. Is this a WebRTC capable browser?');
|
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,10 +154,10 @@ function createPeerConnection() {
|
|||||||
' config: \'' + JSON.stringify(pcConfig) + '\';\n' +
|
' config: \'' + JSON.stringify(pcConfig) + '\';\n' +
|
||||||
' constraints: \'' + JSON.stringify(pcConstraints) + '\'.');
|
' constraints: \'' + JSON.stringify(pcConstraints) + '\'.');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Failed to create PeerConnection, exception: ' + e.message);
|
messageError('Failed to create PeerConnection, exception: ' + e.message);
|
||||||
alert('Cannot create RTCPeerConnection object; \
|
alert('Cannot create RTCPeerConnection object; \
|
||||||
WebRTC is not supported by this browser.');
|
WebRTC is not supported by this browser.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pc.onaddstream = onRemoteStreamAdded;
|
pc.onaddstream = onRemoteStreamAdded;
|
||||||
pc.onremovestream = onRemoteStreamRemoved;
|
pc.onremovestream = onRemoteStreamRemoved;
|
||||||
@ -265,7 +262,7 @@ function sendMessage(message) {
|
|||||||
|
|
||||||
function processSignalingMessage(message) {
|
function processSignalingMessage(message) {
|
||||||
if (!started) {
|
if (!started) {
|
||||||
console.log('peerConnection has not been created yet!');
|
messageError('peerConnection has not been created yet!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,6 +286,7 @@ function onChannelOpened() {
|
|||||||
channelReady = true;
|
channelReady = true;
|
||||||
maybeStart();
|
maybeStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelMessage(message) {
|
function onChannelMessage(message) {
|
||||||
console.log('S->C: ' + message.data);
|
console.log('S->C: ' + message.data);
|
||||||
var msg = JSON.parse(message.data);
|
var msg = JSON.parse(message.data);
|
||||||
@ -310,13 +308,21 @@ function onChannelMessage(message) {
|
|||||||
processSignalingMessage(msg);
|
processSignalingMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelError() {
|
function onChannelError() {
|
||||||
console.log('Channel error.');
|
messageError('Channel error.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelClosed() {
|
function onChannelClosed() {
|
||||||
console.log('Channel closed.');
|
console.log('Channel closed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function messageError(msg) {
|
||||||
|
console.log(msg);
|
||||||
|
infoDivErrors.push(msg);
|
||||||
|
updateInfoDiv();
|
||||||
|
}
|
||||||
|
|
||||||
function onUserMediaSuccess(stream) {
|
function onUserMediaSuccess(stream) {
|
||||||
console.log('User has granted access to local media.');
|
console.log('User has granted access to local media.');
|
||||||
// Call the polyfill wrapper to attach the media stream to this element.
|
// Call the polyfill wrapper to attach the media stream to this element.
|
||||||
@ -328,17 +334,17 @@ function onUserMediaSuccess(stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onUserMediaError(error) {
|
function onUserMediaError(error) {
|
||||||
var msg = 'Failed to get access to local media. Error code was ' +
|
messageError('Failed to get access to local media. Error code was ' +
|
||||||
error.code + '. Continuing without sending a stream.';
|
error.code + '. Continuing without sending a stream.');
|
||||||
console.log(msg);
|
alert('Failed to get access to local media. Error code was ' +
|
||||||
alert(msg);
|
error.code + '. Continuing without sending a stream.');
|
||||||
|
|
||||||
hasLocalStream = false;
|
hasLocalStream = false;
|
||||||
maybeStart();
|
maybeStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCreateSessionDescriptionError(error) {
|
function onCreateSessionDescriptionError(error) {
|
||||||
console.log('Failed to create session description: ' + error.toString());
|
messageError('Failed to create session description: ' + error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSetSessionDescriptionSuccess() {
|
function onSetSessionDescriptionSuccess() {
|
||||||
@ -346,7 +352,7 @@ function onSetSessionDescriptionSuccess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onSetSessionDescriptionError(error) {
|
function onSetSessionDescriptionError(error) {
|
||||||
console.log('Failed to set session description: ' + error.toString());
|
messageError('Failed to set session description: ' + error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
function iceCandidateType(candidateSDP) {
|
function iceCandidateType(candidateSDP) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user