try audio-only when GUM fails

This commit is contained in:
Philipp Hancke 2014-11-22 14:46:35 -08:00
parent 2004b6ef18
commit 728e7ce70b
1 changed files with 24 additions and 15 deletions

39
app.js
View File

@ -154,24 +154,33 @@ function connect(jid, password) {
*/ */
function obtainAudioAndVideoPermissions(callback) { function obtainAudioAndVideoPermissions(callback) {
// Get AV // Get AV
var cb = function (stream) {
console.log('got', stream, stream.getAudioTracks().length, stream.getVideoTracks().length);
callback(stream);
trackUsage('localMedia', {
audio: stream.getAudioTracks().length,
video: stream.getVideoTracks().length
});
}
getUserMediaWithConstraints( getUserMediaWithConstraints(
['audio', 'video'], ['audio', 'video'],
function (avStream) { cb,
callback(avStream);
trackUsage('localMedia', {
audio: avStream.getAudioTracks().length,
video: avStream.getVideoTracks().length
});
},
function (error) { function (error) {
console.error('failed to obtain audio/video stream - stop', error); console.error('failed to obtain audio/video stream - trying audio only', error);
trackUsage('localMediaError', { getUserMediaWithConstraints(
media: error.media || 'video', ['audio'],
name : error.name cb,
}); function (error) {
messageHandler.showError("Error", console.error('failed to obtain audio/video stream - stop', error);
"Failed to obtain permissions to use the local microphone" + trackUsage('localMediaError', {
"and/or camera."); media: error.media || 'video',
name : error.name
});
messageHandler.showError("Error",
"Failed to obtain permissions to use the local microphone" +
"and/or camera.");
}
);
}, },
config.resolution || '360'); config.resolution || '360');
} }