|
@@ -34,6 +34,7 @@ import {
|
34
|
34
|
DATA_CHANNEL_OPENED,
|
35
|
35
|
SET_AUDIO_ONLY,
|
36
|
36
|
SET_LASTN,
|
|
37
|
+ SET_MAX_RECEIVER_VIDEO_QUALITY,
|
37
|
38
|
SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
|
38
|
39
|
SET_ROOM
|
39
|
40
|
} from './actionTypes';
|
|
@@ -80,6 +81,9 @@ MiddlewareRegistry.register(store => next => action => {
|
80
|
81
|
case SET_LASTN:
|
81
|
82
|
return _setLastN(store, next, action);
|
82
|
83
|
|
|
84
|
+ case SET_MAX_RECEIVER_VIDEO_QUALITY:
|
|
85
|
+ return _setMaximumReceiverVideoQuality(store, next, action);
|
|
86
|
+
|
83
|
87
|
case SET_PREFERRED_RECEIVER_VIDEO_QUALITY:
|
84
|
88
|
return _setPreferredReceiverVideoQuality(store, next, action);
|
85
|
89
|
|
|
@@ -434,7 +438,38 @@ function _setLastN({ getState }, next, action) {
|
434
|
438
|
}
|
435
|
439
|
|
436
|
440
|
/**
|
437
|
|
- * Sets the maximum receive video quality and will turn off audio only mode if
|
|
441
|
+ * Sets an internal maximum for the video frame height to receive from remote
|
|
442
|
+ * videos. This maximum acts as a cap so user preferences cannot exceed a
|
|
443
|
+ * specified frame height.
|
|
444
|
+ *
|
|
445
|
+ * @private
|
|
446
|
+ * @param {Store} store - The redux store in which the specified {@code action}
|
|
447
|
+ * is being dispatched.
|
|
448
|
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
|
|
449
|
+ * specified {@code action} to the specified {@code store}.
|
|
450
|
+ * @param {Action} action - The redux action
|
|
451
|
+ * {@code SET_MAXIMUM_RECEIVER_VIDEO_QUALITY} which is being dispatched in the
|
|
452
|
+ * specified {@code store}.
|
|
453
|
+ * @private
|
|
454
|
+ * @returns {Object} The value returned by {@code next(action)}.
|
|
455
|
+ */
|
|
456
|
+function _setMaximumReceiverVideoQuality({ getState }, next, action) {
|
|
457
|
+ const { conference, preferredReceiverVideoQuality }
|
|
458
|
+ = getState()['features/base/conference'];
|
|
459
|
+
|
|
460
|
+ if (conference) {
|
|
461
|
+ if (typeof preferredReceiverVideoQuality === 'undefined'
|
|
462
|
+ || preferredReceiverVideoQuality > action.maxReceiverVideoQuality) {
|
|
463
|
+ conference.setReceiverVideoConstraint(
|
|
464
|
+ action.maxReceiverVideoQuality);
|
|
465
|
+ }
|
|
466
|
+ }
|
|
467
|
+
|
|
468
|
+ return next(action);
|
|
469
|
+}
|
|
470
|
+
|
|
471
|
+/**
|
|
472
|
+ * Sets the preferred receive video quality and will turn off audio only mode if
|
438
|
473
|
* enabled.
|
439
|
474
|
*
|
440
|
475
|
* @param {Store} store - The redux store in which the specified {@code action}
|
|
@@ -451,12 +486,19 @@ function _setPreferredReceiverVideoQuality(
|
451
|
486
|
{ dispatch, getState },
|
452
|
487
|
next,
|
453
|
488
|
action) {
|
454
|
|
- const { audioOnly, conference }
|
455
|
|
- = getState()['features/base/conference'];
|
|
489
|
+ const {
|
|
490
|
+ audioOnly,
|
|
491
|
+ conference,
|
|
492
|
+ maxReceiverVideoQuality
|
|
493
|
+ } = getState()['features/base/conference'];
|
456
|
494
|
|
457
|
495
|
if (conference) {
|
458
|
|
- conference.setReceiverVideoConstraint(
|
459
|
|
- action.preferredReceiverVideoQuality);
|
|
496
|
+ const { preferredReceiverVideoQuality } = action;
|
|
497
|
+ const targetQuality = typeof maxReceiverVideoQuality === 'undefined'
|
|
498
|
+ ? preferredReceiverVideoQuality
|
|
499
|
+ : Math.min(maxReceiverVideoQuality, preferredReceiverVideoQuality);
|
|
500
|
+
|
|
501
|
+ conference.setReceiverVideoConstraint(targetQuality);
|
460
|
502
|
audioOnly && dispatch(toggleAudioOnly());
|
461
|
503
|
}
|
462
|
504
|
|