ref(conference): try video only

Will make an attempt to create video only stream in case microphone
permissions were not granted.
This commit is contained in:
paweldomas 2017-07-10 13:42:22 +02:00 committed by virtuacoplenny
parent de2eee2e61
commit 63377a2f76
1 changed files with 11 additions and 3 deletions

View File

@ -134,7 +134,8 @@ function connect(roomName) {
*/
function createInitialLocalTracksAndConnect(roomName) {
let audioAndVideoError,
audioOnlyError;
audioOnlyError,
videoOnlyError;
JitsiMeetJS.mediaDevices.addEventListener(
JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN,
@ -152,8 +153,14 @@ function createInitialLocalTracksAndConnect(roomName) {
return createLocalTracks({ devices: ['audio'] }, true);
})
.catch(err => {
// If audio failed too then just return empty array for tracks.
audioOnlyError = err;
// Try video only...
return createLocalTracks({ devices: ['video'] }, true);
})
.catch(err => {
videoOnlyError = err;
return [];
});
@ -165,7 +172,8 @@ function createInitialLocalTracksAndConnect(roomName) {
// If both requests for 'audio' + 'video' and 'audio' only
// failed, we assume that there is some problems with user's
// microphone and show corresponding dialog.
APP.UI.showDeviceErrorDialog(audioOnlyError, null);
APP.UI.showDeviceErrorDialog(
audioOnlyError, videoOnlyError);
} else {
// If request for 'audio' + 'video' failed, but request for
// 'audio' only was OK, we assume that we had problems with