Browse Source

Skips storing devices (mic and camera) if there is no user selection.

Skips storing device ids in localstorage if the user hasn't selected a device to use, and keeps using system defaults. Removes calls to private library method for setting initial realDeviceIds, as this had been added to the library.
master
damencho 8 years ago
parent
commit
0683f94edb
2 changed files with 14 additions and 10 deletions
  1. 6
    6
      conference.js
  2. 8
    4
      modules/settings/Settings.js

+ 6
- 6
conference.js View File

@@ -1416,7 +1416,7 @@ export default {
1416 1416
                 .then(([stream]) => {
1417 1417
                     this.useVideoStream(stream);
1418 1418
                     console.log('switched local video device');
1419
-                    APP.settings.setCameraDeviceId(cameraDeviceId);
1419
+                    APP.settings.setCameraDeviceId(cameraDeviceId, true);
1420 1420
                 })
1421 1421
                 .catch((err) => {
1422 1422
                     APP.UI.showDeviceErrorDialog(null, err);
@@ -1438,7 +1438,7 @@ export default {
1438 1438
                 .then(([stream]) => {
1439 1439
                     this.useAudioStream(stream);
1440 1440
                     console.log('switched local audio device');
1441
-                    APP.settings.setMicDeviceId(micDeviceId);
1441
+                    APP.settings.setMicDeviceId(micDeviceId, true);
1442 1442
                 })
1443 1443
                 .catch((err) => {
1444 1444
                     APP.UI.showDeviceErrorDialog(err, null);
@@ -1533,13 +1533,13 @@ export default {
1533 1533
                 // storage and settings menu. This is a workaround until
1534 1534
                 // getConstraints() method will be implemented in browsers.
1535 1535
                 if (localAudio) {
1536
-                    localAudio._setRealDeviceIdFromDeviceList(devices);
1537
-                    APP.settings.setMicDeviceId(localAudio.getDeviceId());
1536
+                    APP.settings.setMicDeviceId(
1537
+                        localAudio.getDeviceId(), false);
1538 1538
                 }
1539 1539
 
1540 1540
                 if (localVideo) {
1541
-                    localVideo._setRealDeviceIdFromDeviceList(devices);
1542
-                    APP.settings.setCameraDeviceId(localVideo.getDeviceId());
1541
+                    APP.settings.setCameraDeviceId(
1542
+                        localVideo.getDeviceId(), false);
1543 1543
                 }
1544 1544
 
1545 1545
                 mediaDeviceHelper.setCurrentMediaDevices(devices);

+ 8
- 4
modules/settings/Settings.js View File

@@ -174,10 +174,12 @@ export default {
174 174
      * Set device id of the camera which is currently in use.
175 175
      * Empty string stands for default device.
176 176
      * @param {string} newId new camera device id
177
+     * @param {boolean} whether we need to store the value
177 178
      */
178
-    setCameraDeviceId: function (newId = '') {
179
+    setCameraDeviceId: function (newId, store) {
179 180
         cameraDeviceId = newId;
180
-        window.localStorage.cameraDeviceId = newId;
181
+        if (store)
182
+            window.localStorage.cameraDeviceId = newId;
181 183
     },
182 184
 
183 185
     /**
@@ -192,10 +194,12 @@ export default {
192 194
      * Set device id of the microphone which is currently in use.
193 195
      * Empty string stands for default device.
194 196
      * @param {string} newId new microphone device id
197
+     * @param {boolean} whether we need to store the value
195 198
      */
196
-    setMicDeviceId: function (newId = '') {
199
+    setMicDeviceId: function (newId, store) {
197 200
         micDeviceId = newId;
198
-        window.localStorage.micDeviceId = newId;
201
+        if (store)
202
+            window.localStorage.micDeviceId = newId;
199 203
     },
200 204
 
201 205
     /**

Loading…
Cancel
Save