Bläddra i källkod

fix(RTC): Do not overwrite other constraints when resolution option is used.

When the resolution option was being used, all the other constraints like frameRate and facing mode were being overwritten.
tags/v0.0.2
Jaya Allamsetty 4 år sedan
förälder
incheckning
46ec23fcdc
1 ändrade filer med 8 tillägg och 19 borttagningar
  1. 8
    19
      modules/RTC/RTCUtils.js

+ 8
- 19
modules/RTC/RTCUtils.js Visa fil

@@ -96,22 +96,13 @@ function emptyFuncton() {
96 96
 /**
97 97
  * Creates a constraints object to be passed into a call to getUserMedia.
98 98
  *
99
- * @param {Array} um - An array of user media types to get. The accepted
100
- * types are "video", "audio", and "desktop."
99
+ * @param {Array} um - An array of user media types to get. The accepted types are "video", "audio", and "desktop."
101 100
  * @param {Object} options - Various values to be added to the constraints.
102
- * @param {string} options.cameraDeviceId - The device id for the video
103
- * capture device to get video from.
104
- * @param {Object} options.constraints - Default constraints object to use
105
- * as a base for the returned constraints.
106
- * @param {Object} options.desktopStream - The desktop source id from which
107
- * to capture a desktop sharing video.
108
- * @param {string} options.facingMode - Which direction the camera is
109
- * pointing to.
110
- * @param {string} options.micDeviceId - The device id for the audio capture
111
- * device to get audio from.
112
- * @param {Object} options.frameRate - used only for dekstop sharing.
113
- * @param {Object} options.frameRate.min - Minimum fps
114
- * @param {Object} options.frameRate.max - Maximum fps
101
+ * @param {string} options.cameraDeviceId - The device id for the video capture device to get video from.
102
+ * @param {Object} options.constraints - Default constraints object to use as a base for the returned constraints.
103
+ * @param {Object} options.desktopStream - The desktop source id from which to capture a desktop sharing video.
104
+ * @param {string} options.facingMode - Which direction the camera is pointing to (applicable on mobile)
105
+ * @param {string} options.micDeviceId - The device id for the audio capture device to get audio from.
115 106
  * @private
116 107
  * @returns {Object}
117 108
  */
@@ -125,10 +116,8 @@ function getConstraints(um = [], options = {}) {
125 116
         if (Resolutions[options.resolution]) {
126 117
             const r = Resolutions[options.resolution];
127 118
 
128
-            constraints.video = {
129
-                height: { ideal: r.height },
130
-                width: { ideal: r.width }
131
-            };
119
+            constraints.video.height = { ideal: r.height };
120
+            constraints.video.width = { ideal: r.width };
132 121
         }
133 122
 
134 123
         if (!constraints.video) {

Laddar…
Avbryt
Spara