Quellcode durchsuchen

Merge pull request #772 from jitsi/crash_no_mediastreamtrack

Fix a crash on IE/Safari when plugin is not installed
j8
yanas vor 9 Jahren
Ursprung
Commit
ced7da405d
1 geänderte Dateien mit 29 neuen und 22 gelöschten Zeilen
  1. 29
    22
      modules/UI/side_pannels/settings/SettingsMenu.js

+ 29
- 22
modules/UI/side_pannels/settings/SettingsMenu.js Datei anzeigen

@@ -137,30 +137,37 @@ export default {
137 137
 
138 138
 
139 139
         // DEVICES LIST
140
-        if (JitsiMeetJS.mediaDevices.isDeviceListAvailable() &&
141
-            JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) {
142
-            this.changeDevicesList([]);
143
-
144
-            $('#selectCamera').change(function () {
145
-                let cameraDeviceId = $(this).val();
146
-                if (cameraDeviceId !== Settings.getCameraDeviceId()) {
147
-                    emitter.emit(UIEvents.VIDEO_DEVICE_CHANGED, cameraDeviceId);
140
+        JitsiMeetJS.mediaDevices.isDeviceListAvailable()
141
+            .then((isDeviceListAvailable) => {
142
+                if (isDeviceListAvailable &&
143
+                    JitsiMeetJS.mediaDevices.isDeviceChangeAvailable()) {
144
+                    this._initializeDeviceSelectionSettings(emitter);
148 145
                 }
149 146
             });
150
-            $('#selectMic').change(function () {
151
-                let micDeviceId = $(this).val();
152
-                if (micDeviceId !== Settings.getMicDeviceId()) {
153
-                    emitter.emit(UIEvents.AUDIO_DEVICE_CHANGED, micDeviceId);
154
-                }
155
-            });
156
-            $('#selectAudioOutput').change(function () {
157
-                let audioOutputDeviceId = $(this).val();
158
-                if (audioOutputDeviceId !== Settings.getAudioOutputDeviceId()) {
159
-                    emitter.emit(UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED,
160
-                        audioOutputDeviceId);
161
-                }
162
-            });
163
-        }
147
+    },
148
+
149
+    _initializeDeviceSelectionSettings(emitter) {
150
+        this.changeDevicesList([]);
151
+
152
+        $('#selectCamera').change(function () {
153
+            let cameraDeviceId = $(this).val();
154
+            if (cameraDeviceId !== Settings.getCameraDeviceId()) {
155
+                emitter.emit(UIEvents.VIDEO_DEVICE_CHANGED, cameraDeviceId);
156
+            }
157
+        });
158
+        $('#selectMic').change(function () {
159
+            let micDeviceId = $(this).val();
160
+            if (micDeviceId !== Settings.getMicDeviceId()) {
161
+                emitter.emit(UIEvents.AUDIO_DEVICE_CHANGED, micDeviceId);
162
+            }
163
+        });
164
+        $('#selectAudioOutput').change(function () {
165
+            let audioOutputDeviceId = $(this).val();
166
+            if (audioOutputDeviceId !== Settings.getAudioOutputDeviceId()) {
167
+                emitter.emit(
168
+                    UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED, audioOutputDeviceId);
169
+            }
170
+        });
164 171
     },
165 172
 
166 173
     /**

Laden…
Abbrechen
Speichern