Parcourir la source

Merge pull request #844 from jitsi/device-selection-rework

Device selection rework
j8
hristoterezov il y a 8 ans
Parent
révision
84983c341e
2 fichiers modifiés avec 14 ajouts et 10 suppressions
  1. 6
    6
      conference.js
  2. 8
    4
      modules/settings/Settings.js

+ 6
- 6
conference.js Voir le fichier

@@ -1424,7 +1424,7 @@ export default {
1424 1424
                 .then(([stream]) => {
1425 1425
                     this.useVideoStream(stream);
1426 1426
                     console.log('switched local video device');
1427
-                    APP.settings.setCameraDeviceId(cameraDeviceId);
1427
+                    APP.settings.setCameraDeviceId(cameraDeviceId, true);
1428 1428
                 })
1429 1429
                 .catch((err) => {
1430 1430
                     APP.UI.showDeviceErrorDialog(null, err);
@@ -1446,7 +1446,7 @@ export default {
1446 1446
                 .then(([stream]) => {
1447 1447
                     this.useAudioStream(stream);
1448 1448
                     console.log('switched local audio device');
1449
-                    APP.settings.setMicDeviceId(micDeviceId);
1449
+                    APP.settings.setMicDeviceId(micDeviceId, true);
1450 1450
                 })
1451 1451
                 .catch((err) => {
1452 1452
                     APP.UI.showDeviceErrorDialog(err, null);
@@ -1541,13 +1541,13 @@ export default {
1541 1541
                 // storage and settings menu. This is a workaround until
1542 1542
                 // getConstraints() method will be implemented in browsers.
1543 1543
                 if (localAudio) {
1544
-                    localAudio._setRealDeviceIdFromDeviceList(devices);
1545
-                    APP.settings.setMicDeviceId(localAudio.getDeviceId());
1544
+                    APP.settings.setMicDeviceId(
1545
+                        localAudio.getDeviceId(), false);
1546 1546
                 }
1547 1547
 
1548 1548
                 if (localVideo) {
1549
-                    localVideo._setRealDeviceIdFromDeviceList(devices);
1550
-                    APP.settings.setCameraDeviceId(localVideo.getDeviceId());
1549
+                    APP.settings.setCameraDeviceId(
1550
+                        localVideo.getDeviceId(), false);
1551 1551
                 }
1552 1552
 
1553 1553
                 mediaDeviceHelper.setCurrentMediaDevices(devices);

+ 8
- 4
modules/settings/Settings.js Voir le fichier

@@ -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
     /**

Chargement…
Annuler
Enregistrer