|
|
@@ -109,14 +109,28 @@ function setResolutionConstraints(constraints, resolution) {
|
|
109
|
109
|
function getConstraints(um, options) {
|
|
110
|
110
|
var constraints = {audio: false, video: false};
|
|
111
|
111
|
|
|
|
112
|
+ // Don't mix new and old style settings for Chromium as this leads
|
|
|
113
|
+ // to TypeError in new Chromium versions. @see
|
|
|
114
|
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=614716
|
|
|
115
|
+ // This is a temporary solution, in future we will fully split old and
|
|
|
116
|
+ // new style constraints when new versions of Chromium and Firefox will
|
|
|
117
|
+ // have stable support of new constraints format. For more information
|
|
|
118
|
+ // @see https://github.com/jitsi/lib-jitsi-meet/pull/136
|
|
|
119
|
+ var isNewStyleConstraintsSupported =
|
|
|
120
|
+ RTCBrowserType.isFirefox() ||
|
|
|
121
|
+ RTCBrowserType.isReactNative() ||
|
|
|
122
|
+ RTCBrowserType.isTemasysPluginUsed();
|
|
|
123
|
+
|
|
112
|
124
|
if (um.indexOf('video') >= 0) {
|
|
113
|
125
|
// same behaviour as true
|
|
114
|
126
|
constraints.video = { mandatory: {}, optional: [] };
|
|
115
|
127
|
|
|
116
|
128
|
if (options.cameraDeviceId) {
|
|
117
|
|
- // new style of settings device id (FF only)
|
|
118
|
|
- constraints.video.deviceId = options.cameraDeviceId;
|
|
119
|
|
- // old style
|
|
|
129
|
+ if (isNewStyleConstraintsSupported) {
|
|
|
130
|
+ // New style of setting device id.
|
|
|
131
|
+ constraints.video.deviceId = options.cameraDeviceId;
|
|
|
132
|
+ }
|
|
|
133
|
+ // Old style.
|
|
120
|
134
|
constraints.video.optional.push({
|
|
121
|
135
|
sourceId: options.cameraDeviceId
|
|
122
|
136
|
});
|
|
|
@@ -126,7 +140,13 @@ function getConstraints(um, options) {
|
|
126
|
140
|
// TODO: Maybe use "exact" syntax if options.facingMode is defined,
|
|
127
|
141
|
// but this probably needs to be decided when updating other
|
|
128
|
142
|
// constraints, as we currently don't use "exact" syntax anywhere.
|
|
129
|
|
- constraints.video.facingMode = options.facingMode || 'user';
|
|
|
143
|
+ if (isNewStyleConstraintsSupported) {
|
|
|
144
|
+ constraints.video.facingMode = options.facingMode || 'user';
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+ constraints.video.optional.push({
|
|
|
148
|
+ facingMode: options.facingMode || 'user'
|
|
|
149
|
+ });
|
|
130
|
150
|
}
|
|
131
|
151
|
|
|
132
|
152
|
constraints.video.optional.push({ googLeakyBucket: true });
|
|
|
@@ -142,9 +162,11 @@ function getConstraints(um, options) {
|
|
142
|
162
|
// same behaviour as true
|
|
143
|
163
|
constraints.audio = { mandatory: {}, optional: []};
|
|
144
|
164
|
if (options.micDeviceId) {
|
|
145
|
|
- // new style of settings device id (FF only)
|
|
146
|
|
- constraints.audio.deviceId = options.micDeviceId;
|
|
147
|
|
- // old style
|
|
|
165
|
+ if (isNewStyleConstraintsSupported) {
|
|
|
166
|
+ // New style of setting device id.
|
|
|
167
|
+ constraints.audio.deviceId = options.micDeviceId;
|
|
|
168
|
+ }
|
|
|
169
|
+ // Old style.
|
|
148
|
170
|
constraints.audio.optional.push({
|
|
149
|
171
|
sourceId: options.micDeviceId
|
|
150
|
172
|
});
|