|
|
@@ -399,12 +399,12 @@ export default {
|
|
399
|
399
|
// If both requests for 'audio' + 'video' and 'audio' only
|
|
400
|
400
|
// failed, we assume that there is some problems with user's
|
|
401
|
401
|
// microphone and show corresponding dialog.
|
|
402
|
|
- APP.UI.showDeviceErrorDialog('microphone', audioOnlyError);
|
|
|
402
|
+ APP.UI.showDeviceErrorDialog(audioOnlyError, null);
|
|
403
|
403
|
} else {
|
|
404
|
404
|
// If request for 'audio' + 'video' failed, but request for
|
|
405
|
405
|
// 'audio' only was OK, we assume that we had problems with
|
|
406
|
406
|
// camera and show corresponding dialog.
|
|
407
|
|
- APP.UI.showDeviceErrorDialog('camera', audioAndVideoError);
|
|
|
407
|
+ APP.UI.showDeviceErrorDialog(null, audioAndVideoError);
|
|
408
|
408
|
}
|
|
409
|
409
|
}
|
|
410
|
410
|
|
|
|
@@ -563,56 +563,78 @@ export default {
|
|
563
|
563
|
}
|
|
564
|
564
|
|
|
565
|
565
|
function createNewTracks(type, cameraDeviceId, micDeviceId) {
|
|
566
|
|
- let audioOnlyError, videoOnlyError;
|
|
567
|
|
-
|
|
568
|
|
- return createLocalTracks(type, cameraDeviceId, micDeviceId)
|
|
569
|
|
- .then(onTracksCreated)
|
|
570
|
|
- .catch((err) => {
|
|
571
|
|
- // if we tried to create both audio and video tracks
|
|
572
|
|
- // at once and failed, let's try again only with
|
|
573
|
|
- // audio. Such situation may happen in case if we
|
|
574
|
|
- // granted access only to microphone, but not to
|
|
575
|
|
- // camera.
|
|
576
|
|
- if (type.indexOf('audio') !== -1
|
|
577
|
|
- && type.indexOf('video') !== -1) {
|
|
578
|
|
- return createLocalTracks(['audio'], null,
|
|
579
|
|
- micDeviceId);
|
|
580
|
|
- } else if (type.indexOf('audio') !== -1) {
|
|
581
|
|
- audioOnlyError = err;
|
|
582
|
|
- } else if (type.indexOf('video') !== -1) {
|
|
583
|
|
- videoOnlyError = err;
|
|
584
|
|
- }
|
|
585
|
|
-
|
|
586
|
|
- })
|
|
587
|
|
- .then(onTracksCreated)
|
|
588
|
|
- .catch((err) => {
|
|
589
|
|
- // if we tried to create both audio and video tracks
|
|
590
|
|
- // at once and failed, let's try again only with
|
|
591
|
|
- // video. Such situation may happen in case if we
|
|
592
|
|
- // granted access only to camera, but not to
|
|
593
|
|
- // microphone.
|
|
594
|
|
- audioOnlyError = err;
|
|
595
|
|
- if (type.indexOf('audio') !== -1
|
|
596
|
|
- && type.indexOf('video') !== -1) {
|
|
597
|
|
- return createLocalTracks(['video'],
|
|
598
|
|
- cameraDeviceId,
|
|
599
|
|
- null);
|
|
600
|
|
- }
|
|
601
|
|
- })
|
|
602
|
|
- .then(onTracksCreated)
|
|
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
|
|
- }
|
|
615
|
|
- });
|
|
|
566
|
+ let audioTrackCreationError;
|
|
|
567
|
+ let videoTrackCreationError;
|
|
|
568
|
+ let audioRequested = type.indexOf('audio') !== -1;
|
|
|
569
|
+ let videoRequested = type.indexOf('video') !== -1;
|
|
|
570
|
+ let promise;
|
|
|
571
|
+
|
|
|
572
|
+ if (audioRequested && micDeviceId !== null) {
|
|
|
573
|
+ if (videoRequested && cameraDeviceId !== null) {
|
|
|
574
|
+ promise = createLocalTracks(
|
|
|
575
|
+ type, cameraDeviceId, micDeviceId)
|
|
|
576
|
+ .catch(() => {
|
|
|
577
|
+ return Promise.all([
|
|
|
578
|
+ createAudioTrack(false),
|
|
|
579
|
+ createVideoTrack(false)]);
|
|
|
580
|
+ })
|
|
|
581
|
+ .then((audioTracks, videoTracks) => {
|
|
|
582
|
+ if (audioTrackCreationError) {
|
|
|
583
|
+ if (videoTrackCreationError) {
|
|
|
584
|
+ APP.UI.showDeviceErrorDialog(
|
|
|
585
|
+ audioTrackCreationError,
|
|
|
586
|
+ videoTrackCreationError);
|
|
|
587
|
+ } else {
|
|
|
588
|
+ APP.UI.showDeviceErrorDialog(
|
|
|
589
|
+ audioTrackCreationError,
|
|
|
590
|
+ null);
|
|
|
591
|
+ }
|
|
|
592
|
+ } else if (videoTrackCreationError) {
|
|
|
593
|
+ APP.UI.showDeviceErrorDialog(
|
|
|
594
|
+ null,
|
|
|
595
|
+ videoTrackCreationError);
|
|
|
596
|
+ }
|
|
|
597
|
+
|
|
|
598
|
+ return audioTracks.concat(videoTracks);
|
|
|
599
|
+ });
|
|
|
600
|
+ } else {
|
|
|
601
|
+ promise = createAudioTrack();
|
|
|
602
|
+ }
|
|
|
603
|
+ } else if (videoRequested && cameraDeviceId !== null) {
|
|
|
604
|
+ promise = createVideoTrack();
|
|
|
605
|
+ } else {
|
|
|
606
|
+ promise = Promise.resolve([]);
|
|
|
607
|
+ }
|
|
|
608
|
+
|
|
|
609
|
+ return promise
|
|
|
610
|
+ .then(onTracksCreated);
|
|
|
611
|
+
|
|
|
612
|
+ function createAudioTrack(showError) {
|
|
|
613
|
+ return createLocalTracks(['audio'], null, micDeviceId)
|
|
|
614
|
+ .catch(err => {
|
|
|
615
|
+ audioTrackCreationError = err;
|
|
|
616
|
+
|
|
|
617
|
+ if (showError) {
|
|
|
618
|
+ APP.UI.showDeviceErrorDialog(err, null);
|
|
|
619
|
+ }
|
|
|
620
|
+
|
|
|
621
|
+ return [];
|
|
|
622
|
+ });
|
|
|
623
|
+ }
|
|
|
624
|
+
|
|
|
625
|
+ function createVideoTrack(showError) {
|
|
|
626
|
+ return createLocalTracks(
|
|
|
627
|
+ ['video'], cameraDeviceId, null)
|
|
|
628
|
+ .catch(err => {
|
|
|
629
|
+ videoTrackCreationError = err;
|
|
|
630
|
+
|
|
|
631
|
+ if (showError) {
|
|
|
632
|
+ APP.UI.showDeviceErrorDialog(null, err);
|
|
|
633
|
+ }
|
|
|
634
|
+
|
|
|
635
|
+ return [];
|
|
|
636
|
+ });
|
|
|
637
|
+ }
|
|
616
|
638
|
}
|
|
617
|
639
|
|
|
618
|
640
|
function onTracksCreated(tracks) {
|
|
|
@@ -1034,15 +1056,20 @@ export default {
|
|
1034
|
1056
|
// TrackErrors.CHROME_EXTENSION_INSTALLATION_ERROR
|
|
1035
|
1057
|
// TrackErrors.GENERAL
|
|
1036
|
1058
|
// and any other
|
|
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");
|
|
|
1059
|
+ let dialogTxt;
|
|
|
1060
|
+ let dialogTitle;
|
|
|
1061
|
+
|
|
|
1062
|
+ if (err.name === TrackErrors.PERMISSION_DENIED) {
|
|
|
1063
|
+ dialogTxt = APP.translation.generateTranslationHTML(
|
|
|
1064
|
+ "dialog.screenSharingPermissionDeniedError");
|
|
|
1065
|
+ dialogTitle = APP.translation.generateTranslationHTML(
|
|
|
1066
|
+ "dialog.error");
|
|
|
1067
|
+ } else {
|
|
|
1068
|
+ dialogTxt = APP.translation.generateTranslationHTML(
|
|
|
1069
|
+ "dialog.failtoinstall");
|
|
|
1070
|
+ dialogTitle = APP.translation.generateTranslationHTML(
|
|
|
1071
|
+ "dialog.permissionDenied");
|
|
|
1072
|
+ }
|
|
1046
|
1073
|
|
|
1047
|
1074
|
APP.UI.messageHandler.openDialog(dialogTitle, dialogTxt, false);
|
|
1048
|
1075
|
});
|
|
|
@@ -1404,7 +1431,7 @@ export default {
|
|
1404
|
1431
|
APP.settings.setCameraDeviceId(cameraDeviceId);
|
|
1405
|
1432
|
})
|
|
1406
|
1433
|
.catch((err) => {
|
|
1407
|
|
- APP.UI.showDeviceErrorDialog('camera', err);
|
|
|
1434
|
+ APP.UI.showDeviceErrorDialog(null, err);
|
|
1408
|
1435
|
APP.UI.setSelectedCameraFromSettings();
|
|
1409
|
1436
|
});
|
|
1410
|
1437
|
}
|
|
|
@@ -1420,7 +1447,7 @@ export default {
|
|
1420
|
1447
|
APP.settings.setMicDeviceId(micDeviceId);
|
|
1421
|
1448
|
})
|
|
1422
|
1449
|
.catch((err) => {
|
|
1423
|
|
- APP.UI.showDeviceErrorDialog('microphone', err);
|
|
|
1450
|
+ APP.UI.showDeviceErrorDialog(err, null);
|
|
1424
|
1451
|
APP.UI.setSelectedMicFromSettings();
|
|
1425
|
1452
|
});
|
|
1426
|
1453
|
}
|