|
|
@@ -10,6 +10,7 @@ import { AVAILABLE_DEVICE } from '../../service/statistics/AnalyticsEvents';
|
|
10
|
10
|
import CameraFacingMode from '../../service/RTC/CameraFacingMode';
|
|
11
|
11
|
import EventEmitter from 'events';
|
|
12
|
12
|
import { getLogger } from 'jitsi-meet-logger';
|
|
|
13
|
+import clonedeep from 'lodash.clonedeep';
|
|
13
|
14
|
import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
|
|
14
|
15
|
import JitsiTrackError from '../../JitsiTrackError';
|
|
15
|
16
|
import Listenable from '../util/Listenable';
|
|
|
@@ -374,14 +375,29 @@ function getConstraints(um, options = {}) {
|
|
374
|
375
|
function newGetConstraints(um = [], options = {}) {
|
|
375
|
376
|
// Create a deep copy of the constraints to avoid any modification of
|
|
376
|
377
|
// the passed in constraints object.
|
|
377
|
|
- const constraints = JSON.parse(JSON.stringify(
|
|
378
|
|
- options.constraints || DEFAULT_CONSTRAINTS));
|
|
|
378
|
+ const constraints = clonedeep(options.constraints || DEFAULT_CONSTRAINTS);
|
|
379
|
379
|
|
|
380
|
380
|
if (um.indexOf('video') >= 0) {
|
|
381
|
381
|
if (!constraints.video) {
|
|
382
|
382
|
constraints.video = {};
|
|
383
|
383
|
}
|
|
384
|
384
|
|
|
|
385
|
+ // Override the constraints on Safari because of the following webkit bug.
|
|
|
386
|
+ // https://bugs.webkit.org/show_bug.cgi?id=210932
|
|
|
387
|
+ // Camera doesn't start on older macOS versions if min/max constraints are specified.
|
|
|
388
|
+ // TODO: remove this hack when the bug fix is available on Mojave, Sierra and High Sierra.
|
|
|
389
|
+ if (browser.isSafari()) {
|
|
|
390
|
+ if (constraints.video.height && constraints.video.height.ideal) {
|
|
|
391
|
+ constraints.video.height = { ideal: clonedeep(constraints.video.height.ideal) };
|
|
|
392
|
+ } else {
|
|
|
393
|
+ logger.warn('Ideal camera height missing, camera may not start properly');
|
|
|
394
|
+ }
|
|
|
395
|
+ if (constraints.video.width && constraints.video.width.ideal) {
|
|
|
396
|
+ constraints.video.width = { ideal: clonedeep(constraints.video.width.ideal) };
|
|
|
397
|
+ } else {
|
|
|
398
|
+ logger.warn('Ideal camera width missing, camera may not start properly');
|
|
|
399
|
+ }
|
|
|
400
|
+ }
|
|
385
|
401
|
if (options.cameraDeviceId) {
|
|
386
|
402
|
constraints.video.deviceId = options.cameraDeviceId;
|
|
387
|
403
|
} else {
|