|
@@ -38,8 +38,12 @@ const logger = Logger.getLogger(__filename);
|
38
|
38
|
const USER_MEDIA_PERMISSION_PROMPT_TIMEOUT = 1000;
|
39
|
39
|
|
40
|
40
|
/**
|
|
41
|
+ * Gets the next lowest desirable resolution to try for a camera. If the given
|
|
42
|
+ * resolution is already the lowest acceptable resolution, returns null.
|
41
|
43
|
*
|
42
|
|
- * @param resolution
|
|
44
|
+ * @param resolution the current resolution
|
|
45
|
+ * @return the next lowest resolution from the given one, or null if it is
|
|
46
|
+ * already the lowest acceptable resolution.
|
43
|
47
|
*/
|
44
|
48
|
function getLowerResolution(resolution) {
|
45
|
49
|
if (!Resolutions[resolution]) {
|
|
@@ -58,6 +62,10 @@ function getLowerResolution(resolution) {
|
58
|
62
|
}
|
59
|
63
|
});
|
60
|
64
|
|
|
65
|
+ if (resName === resolution) {
|
|
66
|
+ resName = null;
|
|
67
|
+ }
|
|
68
|
+
|
61
|
69
|
return resName;
|
62
|
70
|
}
|
63
|
71
|
|
|
@@ -246,11 +254,14 @@ export default {
|
246
|
254
|
*
|
247
|
255
|
* @param {boolean} (firePermissionPromptIsShownEvent) - if event
|
248
|
256
|
* JitsiMediaDevicesEvents.PERMISSION_PROMPT_IS_SHOWN should be fired
|
|
257
|
+ * @param originalOptions - internal use only, to be able to store the
|
|
258
|
+ * originally requested options.
|
249
|
259
|
* @returns {Promise.<{Array.<JitsiTrack>}, JitsiConferenceError>}
|
250
|
260
|
* A promise that returns an array of created JitsiTracks if resolved,
|
251
|
261
|
* or a JitsiConferenceError if rejected.
|
252
|
262
|
*/
|
253
|
|
- createLocalTracks(options = {}, firePermissionPromptIsShownEvent) {
|
|
263
|
+ createLocalTracks(
|
|
264
|
+ options = {}, firePermissionPromptIsShownEvent, originalOptions) {
|
254
|
265
|
let promiseFulfilled = false;
|
255
|
266
|
|
256
|
267
|
if (firePermissionPromptIsShownEvent === true) {
|
|
@@ -336,7 +347,23 @@ export default {
|
336
|
347
|
reason: 'unsupported resolution'
|
337
|
348
|
}));
|
338
|
349
|
|
339
|
|
- return this.createLocalTracks(options);
|
|
350
|
+ return this.createLocalTracks(
|
|
351
|
+ options,
|
|
352
|
+ undefined,
|
|
353
|
+ originalOptions || Object.assign({}, options));
|
|
354
|
+ }
|
|
355
|
+
|
|
356
|
+ // we tried everything, if there is a mandatory
|
|
357
|
+ // device id, remove it and let gum find a device to
|
|
358
|
+ // use
|
|
359
|
+ if (originalOptions
|
|
360
|
+ && error.gum.constraints
|
|
361
|
+ && error.gum.constraints.video
|
|
362
|
+ && error.gum.constraints.video.mandatory
|
|
363
|
+ && error.gum.constraints.video.mandatory.sourceId) {
|
|
364
|
+ originalOptions.cameraDeviceId = undefined;
|
|
365
|
+
|
|
366
|
+ return this.createLocalTracks(originalOptions);
|
340
|
367
|
}
|
341
|
368
|
}
|
342
|
369
|
|