Pārlūkot izejas kodu

Merge pull request #838 from guusdk/pass-options

fix(RTC): Pass options allowing GUM to work with config
dev1
Saúl Ibarra Corretgé 6 gadus atpakaļ
vecāks
revīzija
d21965bcf6
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 13 papildinājumiem un 13 dzēšanām
  1. 13
    13
      modules/RTC/RTCUtils.js

+ 13
- 13
modules/RTC/RTCUtils.js Parādīt failu

1217
             };
1217
             };
1218
 
1218
 
1219
             obtainDevices({
1219
             obtainDevices({
1220
-                devices: options.devices,
1220
+                options,
1221
                 streams: {},
1221
                 streams: {},
1222
                 successCallback: resolve,
1222
                 successCallback: resolve,
1223
                 errorCallback: reject,
1223
                 errorCallback: reject,
1551
 
1551
 
1552
 /**
1552
 /**
1553
  *
1553
  *
1554
- * @param options
1554
+ * @param context Execution context, containing options and callbacks
1555
  */
1555
  */
1556
-function obtainDevices(options) {
1557
-    if (!options.devices || options.devices.length === 0) {
1558
-        return options.successCallback(options.streams || {});
1556
+function obtainDevices(context) {
1557
+    if (!context.options.devices || context.options.devices.length === 0) {
1558
+        return context.successCallback(context.streams || {});
1559
     }
1559
     }
1560
 
1560
 
1561
-    const device = options.devices.splice(0, 1);
1561
+    const device = context.options.devices.splice(0, 1);
1562
 
1562
 
1563
-    options.deviceGUM[device]()
1563
+    context.deviceGUM[device](context.options)
1564
         .then(stream => {
1564
         .then(stream => {
1565
-            options.streams = options.streams || {};
1566
-            options.streams[device] = stream;
1567
-            obtainDevices(options);
1565
+            context.streams = context.streams || {};
1566
+            context.streams[device] = stream;
1567
+            obtainDevices(context);
1568
         }, error => {
1568
         }, error => {
1569
-            Object.keys(options.streams).forEach(
1570
-                d => rtcUtils.stopMediaStream(options.streams[d]));
1569
+            Object.keys(context.streams).forEach(
1570
+                d => rtcUtils.stopMediaStream(context.streams[d]));
1571
             logger.error(
1571
             logger.error(
1572
                 `failed to obtain ${device} stream - stop`, error);
1572
                 `failed to obtain ${device} stream - stop`, error);
1573
 
1573
 
1574
-            options.errorCallback(error);
1574
+            context.errorCallback(error);
1575
         });
1575
         });
1576
 }
1576
 }
1577
 
1577
 

Notiek ielāde…
Atcelt
Saglabāt