|
|
@@ -375,17 +375,39 @@ export default {
|
|
375
|
375
|
};
|
|
376
|
376
|
}
|
|
377
|
377
|
|
|
|
378
|
+ let audioAndVideoError, audioOnlyError;
|
|
|
379
|
+
|
|
378
|
380
|
return JitsiMeetJS.init(config).then(() => {
|
|
379
|
381
|
return Promise.all([
|
|
380
|
382
|
// try to retrieve audio and video
|
|
381
|
383
|
createLocalTracks(['audio', 'video'])
|
|
382
|
384
|
// if failed then try to retrieve only audio
|
|
383
|
|
- .catch(() => createLocalTracks(['audio']))
|
|
|
385
|
+ .catch(err => {
|
|
|
386
|
+ audioAndVideoError = err;
|
|
|
387
|
+ return createLocalTracks(['audio']);
|
|
|
388
|
+ })
|
|
384
|
389
|
// if audio also failed then just return empty array
|
|
385
|
|
- .catch(() => []),
|
|
|
390
|
+ .catch(err => {
|
|
|
391
|
+ audioOnlyError = err;
|
|
|
392
|
+ return [];
|
|
|
393
|
+ }),
|
|
386
|
394
|
connect(options.roomName)
|
|
387
|
395
|
]);
|
|
388
|
396
|
}).then(([tracks, con]) => {
|
|
|
397
|
+ if (audioAndVideoError) {
|
|
|
398
|
+ if (audioOnlyError) {
|
|
|
399
|
+ // If both requests for 'audio' + 'video' and 'audio' only
|
|
|
400
|
+ // failed, we assume that there is some problems with user's
|
|
|
401
|
+ // microphone and show corresponding dialog.
|
|
|
402
|
+ APP.UI.showDeviceErrorDialog('microphone', audioOnlyError);
|
|
|
403
|
+ } else {
|
|
|
404
|
+ // If request for 'audio' + 'video' failed, but request for
|
|
|
405
|
+ // 'audio' only was OK, we assume that we had problems with
|
|
|
406
|
+ // camera and show corresponding dialog.
|
|
|
407
|
+ APP.UI.showDeviceErrorDialog('camera', audioAndVideoError);
|
|
|
408
|
+ }
|
|
|
409
|
+ }
|
|
|
410
|
+
|
|
389
|
411
|
console.log('initialized with %s local tracks', tracks.length);
|
|
390
|
412
|
APP.connection = connection = con;
|
|
391
|
413
|
this._createRoom(tracks);
|
|
|
@@ -541,9 +563,11 @@ export default {
|
|
541
|
563
|
}
|
|
542
|
564
|
|
|
543
|
565
|
function createNewTracks(type, cameraDeviceId, micDeviceId) {
|
|
|
566
|
+ let audioOnlyError, videoOnlyError;
|
|
|
567
|
+
|
|
544
|
568
|
return createLocalTracks(type, cameraDeviceId, micDeviceId)
|
|
545
|
569
|
.then(onTracksCreated)
|
|
546
|
|
- .catch(() => {
|
|
|
570
|
+ .catch((err) => {
|
|
547
|
571
|
// if we tried to create both audio and video tracks
|
|
548
|
572
|
// at once and failed, let's try again only with
|
|
549
|
573
|
// audio. Such situation may happen in case if we
|
|
|
@@ -553,16 +577,21 @@ export default {
|
|
553
|
577
|
&& type.indexOf('video') !== -1) {
|
|
554
|
578
|
return createLocalTracks(['audio'], null,
|
|
555
|
579
|
micDeviceId);
|
|
|
580
|
+ } else if (type.indexOf('audio') !== -1) {
|
|
|
581
|
+ audioOnlyError = err;
|
|
|
582
|
+ } else if (type.indexOf('video') !== -1) {
|
|
|
583
|
+ videoOnlyError = err;
|
|
556
|
584
|
}
|
|
557
|
585
|
|
|
558
|
586
|
})
|
|
559
|
587
|
.then(onTracksCreated)
|
|
560
|
|
- .catch(() => {
|
|
|
588
|
+ .catch((err) => {
|
|
561
|
589
|
// if we tried to create both audio and video tracks
|
|
562
|
590
|
// at once and failed, let's try again only with
|
|
563
|
591
|
// video. Such situation may happen in case if we
|
|
564
|
592
|
// granted access only to camera, but not to
|
|
565
|
593
|
// microphone.
|
|
|
594
|
+ audioOnlyError = err;
|
|
566
|
595
|
if (type.indexOf('audio') !== -1
|
|
567
|
596
|
&& type.indexOf('video') !== -1) {
|
|
568
|
597
|
return createLocalTracks(['video'],
|
|
|
@@ -571,8 +600,18 @@ export default {
|
|
571
|
600
|
}
|
|
572
|
601
|
})
|
|
573
|
602
|
.then(onTracksCreated)
|
|
574
|
|
- .catch(() => {
|
|
575
|
|
- // can't do anything in this case, so just ignore;
|
|
|
603
|
+ .catch((err) => {
|
|
|
604
|
+ videoOnlyError = err;
|
|
|
605
|
+
|
|
|
606
|
+ if (videoOnlyError) {
|
|
|
607
|
+ APP.UI.showDeviceErrorDialog(
|
|
|
608
|
+ 'camera', videoOnlyError);
|
|
|
609
|
+ }
|
|
|
610
|
+
|
|
|
611
|
+ if (audioOnlyError) {
|
|
|
612
|
+ APP.UI.showDeviceErrorDialog(
|
|
|
613
|
+ 'microphone', audioOnlyError);
|
|
|
614
|
+ }
|
|
576
|
615
|
});
|
|
577
|
616
|
}
|
|
578
|
617
|
|
|
|
@@ -896,13 +935,13 @@ export default {
|
|
896
|
935
|
this.isSharingScreen = stream.videoType === 'desktop';
|
|
897
|
936
|
|
|
898
|
937
|
APP.UI.addLocalStream(stream);
|
|
|
938
|
+
|
|
|
939
|
+ stream.videoType === 'camera' && APP.UI.enableCameraButton();
|
|
899
|
940
|
} else {
|
|
900
|
941
|
this.videoMuted = false;
|
|
901
|
942
|
this.isSharingScreen = false;
|
|
902
|
943
|
}
|
|
903
|
944
|
|
|
904
|
|
- stream.videoType === 'camera' && APP.UI.enableCameraButton();
|
|
905
|
|
-
|
|
906
|
945
|
APP.UI.setVideoMuted(this.localId, this.videoMuted);
|
|
907
|
946
|
|
|
908
|
947
|
APP.UI.updateDesktopSharingButtons();
|
|
|
@@ -990,21 +1029,22 @@ export default {
|
|
990
|
1029
|
return;
|
|
991
|
1030
|
}
|
|
992
|
1031
|
|
|
993
|
|
- // TODO: handle Permission error
|
|
994
|
|
-
|
|
995
|
1032
|
// Handling:
|
|
|
1033
|
+ // TrackErrors.PERMISSION_DENIED
|
|
996
|
1034
|
// TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
|
|
997
|
1035
|
// TrackErrors.GENERAL
|
|
998
|
1036
|
// and any other
|
|
999
|
|
- let dialogTxt = APP.translation
|
|
1000
|
|
- .generateTranslationHTML("dialog.failtoinstall");
|
|
1001
|
|
- let dialogTitle = APP.translation
|
|
1002
|
|
- .generateTranslationHTML("dialog.error");
|
|
1003
|
|
- APP.UI.messageHandler.openDialog(
|
|
1004
|
|
- dialogTitle,
|
|
1005
|
|
- dialogTxt,
|
|
1006
|
|
- false
|
|
1007
|
|
- );
|
|
|
1037
|
+ let dialogTxt = APP.translation.generateTranslationHTML(
|
|
|
1038
|
+ err.name === TrackErrors.PERMISSION_DENIED
|
|
|
1039
|
+ ? "dialog.screenSharingPermissionDeniedError"
|
|
|
1040
|
+ : "dialog.failtoinstall");
|
|
|
1041
|
+
|
|
|
1042
|
+ let dialogTitle = APP.translation.generateTranslationHTML(
|
|
|
1043
|
+ err.name === TrackErrors.PERMISSION_DENIED
|
|
|
1044
|
+ ? "dialog.permissionDenied"
|
|
|
1045
|
+ : "dialog.error");
|
|
|
1046
|
+
|
|
|
1047
|
+ APP.UI.messageHandler.openDialog(dialogTitle, dialogTxt, false);
|
|
1008
|
1048
|
});
|
|
1009
|
1049
|
} else {
|
|
1010
|
1050
|
createLocalTracks(['video']).then(
|
|
|
@@ -1016,6 +1056,8 @@ export default {
|
|
1016
|
1056
|
this.useVideoStream(null);
|
|
1017
|
1057
|
this.videoSwitchInProgress = false;
|
|
1018
|
1058
|
console.error('failed to share local video', err);
|
|
|
1059
|
+
|
|
|
1060
|
+ APP.UI.showDeviceErrorDialog('camera', err);
|
|
1019
|
1061
|
});
|
|
1020
|
1062
|
}
|
|
1021
|
1063
|
},
|
|
|
@@ -1357,22 +1399,32 @@ export default {
|
|
1357
|
1399
|
APP.UI.addListener(
|
|
1358
|
1400
|
UIEvents.VIDEO_DEVICE_CHANGED,
|
|
1359
|
1401
|
(cameraDeviceId) => {
|
|
1360
|
|
- APP.settings.setCameraDeviceId(cameraDeviceId);
|
|
1361
|
|
- createLocalTracks(['video']).then(([stream]) => {
|
|
1362
|
|
- this.useVideoStream(stream);
|
|
1363
|
|
- console.log('switched local video device');
|
|
1364
|
|
- });
|
|
|
1402
|
+ createLocalTracks(['video'])
|
|
|
1403
|
+ .then(([stream]) => {
|
|
|
1404
|
+ this.useVideoStream(stream);
|
|
|
1405
|
+ console.log('switched local video device');
|
|
|
1406
|
+ APP.settings.setCameraDeviceId(cameraDeviceId);
|
|
|
1407
|
+ })
|
|
|
1408
|
+ .catch((err) => {
|
|
|
1409
|
+ APP.UI.showDeviceErrorDialog('camera', err);
|
|
|
1410
|
+ APP.UI.setSelectedCameraFromSettings();
|
|
|
1411
|
+ });
|
|
1365
|
1412
|
}
|
|
1366
|
1413
|
);
|
|
1367
|
1414
|
|
|
1368
|
1415
|
APP.UI.addListener(
|
|
1369
|
1416
|
UIEvents.AUDIO_DEVICE_CHANGED,
|
|
1370
|
1417
|
(micDeviceId) => {
|
|
1371
|
|
- APP.settings.setMicDeviceId(micDeviceId);
|
|
1372
|
|
- createLocalTracks(['audio']).then(([stream]) => {
|
|
1373
|
|
- this.useAudioStream(stream);
|
|
1374
|
|
- console.log('switched local audio device');
|
|
1375
|
|
- });
|
|
|
1418
|
+ createLocalTracks(['audio'])
|
|
|
1419
|
+ .then(([stream]) => {
|
|
|
1420
|
+ this.useAudioStream(stream);
|
|
|
1421
|
+ console.log('switched local audio device');
|
|
|
1422
|
+ APP.settings.setMicDeviceId(micDeviceId);
|
|
|
1423
|
+ })
|
|
|
1424
|
+ .catch((err) => {
|
|
|
1425
|
+ APP.UI.showDeviceErrorDialog('microphone', err);
|
|
|
1426
|
+ APP.UI.setSelectedMicFromSettings();
|
|
|
1427
|
+ });
|
|
1376
|
1428
|
}
|
|
1377
|
1429
|
);
|
|
1378
|
1430
|
|
|
|
@@ -1383,6 +1435,7 @@ export default {
|
|
1383
|
1435
|
.then(() => console.log('changed audio output device'))
|
|
1384
|
1436
|
.catch((err) => {
|
|
1385
|
1437
|
console.error('failed to set audio output device', err);
|
|
|
1438
|
+ APP.UI.setSelectedAudioOutputFromSettings();
|
|
1386
|
1439
|
});
|
|
1387
|
1440
|
}
|
|
1388
|
1441
|
);
|