error_('creating peer connection, but we already have one.');
global.peerConnection = createPeerConnection(STUN_SERVER);
- print_('ok-peerconnection-created');
+ success_('ok-peerconnection-created');
}
/**
/** @private */
function success_(method) {
- print_(method + '(): success.');
+ $('messages').innerHTML += '<span style="color:green;">' + method +
+ '(): success. </span><br>';
}
/** @private */
function getUserMediaOkCallback_(stream) {
global.localStream = stream;
global.requestWebcamAndMicrophoneResult = 'ok-got-stream';
+ success_('getUserMedia');
if (stream.getVideoTracks().length > 0) {
// Show the video tag if we did request video in the getUserMedia call.
var videoTag = $('local-view');
attachMediaStream(videoTag, stream);
- window.addEventListener('loadedmetadata', function() {
- displayVideoSize_(videoTag);}, true);
+ window.addEventListener('loadedmetadata', function() {
+ displayVideoSize_(videoTag);}, true);
+
+ // Throw an error when no video is sent from camera but gUM returns OK.
+ stream.getVideoTracks()[0].onended = function() {
+ error_(global.localStream + ' getUserMedia successful but ' +
+ 'MediaStreamTrack.onended event fired, no frames from camera.');
+ };
}
}
'Element \"' + element.tagName + '\" is not an input element. ');
}
- if (localStorage.getItem(element.id) == 'undefined') {
+ if (localStorage.getItem(element.id) == null) {
storeLocalStorageField_(element);
} else {
getLocalStorageField_(element);
}
+
// Registers the appropriate events for input elements.
if (element.type == 'checkbox') {
element.onclick = function() { storeLocalStorageField_(this); };
/**
* Print error message in the debug log + JS console and throw an Error.
* @private
- * @param {string} message Text to print.
+ * @param {string} message Text to print in red.
*/
function error_(message) {
$('debug').innerHTML += '<span style="color:red;">' + message + '</span><br>';