|
@@ -454,7 +454,7 @@ JitsiLocalTrack.prototype.getDeviceId = function () {
|
454
|
454
|
JitsiLocalTrack.prototype.getCameraFacingMode = function () {
|
455
|
455
|
if (this.isVideoTrack() && this.videoType === VideoType.CAMERA) {
|
456
|
456
|
// MediaStreamTrack#getSettings() is not implemented in many browsers,
|
457
|
|
- // so we need a feature checking here. Progress on the respective
|
|
457
|
+ // so we need feature checking here. Progress on the respective
|
458
|
458
|
// browser's implementation can be tracked at
|
459
|
459
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=2481 for Chromium
|
460
|
460
|
// and https://bugzilla.mozilla.org/show_bug.cgi?id=1213517 for Firefox.
|
|
@@ -462,20 +462,25 @@ JitsiLocalTrack.prototype.getCameraFacingMode = function () {
|
462
|
462
|
// not return anything for 'facingMode'.
|
463
|
463
|
var trackSettings;
|
464
|
464
|
|
465
|
|
- if (this.track &&
|
466
|
|
- typeof this.track.getSettings === 'function' &&
|
467
|
|
- (trackSettings = this.track.getSettings()) &&
|
468
|
|
- 'facingMode' in trackSettings) {
|
|
465
|
+ try {
|
|
466
|
+ trackSettings = this.track.getSettings();
|
|
467
|
+ } catch (e) {
|
|
468
|
+ // XXX React-native-webrtc, for example, defines
|
|
469
|
+ // MediaStreamTrack#getSettings() but the implementation throws a
|
|
470
|
+ // "Not implemented" Error.
|
|
471
|
+ }
|
|
472
|
+ if (trackSettings && 'facingMode' in trackSettings) {
|
469
|
473
|
return trackSettings.facingMode;
|
470
|
|
- } else if (typeof this._facingMode !== 'undefined') {
|
|
474
|
+ }
|
|
475
|
+
|
|
476
|
+ if (typeof this._facingMode !== 'undefined') {
|
471
|
477
|
return this._facingMode;
|
472
|
|
- } else {
|
473
|
|
- // In most cases we are showing a webcam. So if we've gotten here,
|
474
|
|
- // it should be relatively safe to assume that we are probably
|
475
|
|
- // showing the user-facing camera.
|
476
|
|
- return CameraFacingMode.USER;
|
477
|
478
|
}
|
478
|
479
|
|
|
480
|
+ // In most cases we are showing a webcam. So if we've gotten here, it
|
|
481
|
+ // should be relatively safe to assume that we are probably showing
|
|
482
|
+ // the user-facing camera.
|
|
483
|
+ return CameraFacingMode.USER;
|
479
|
484
|
}
|
480
|
485
|
|
481
|
486
|
return undefined;
|