Browse Source

fix(JitsiMediaDevices) prevent multiple listeners when reinitializing

Initializing JitsiMediaDevices doesn't rely on any settings / config
passed on to JitsiMeetJS.init, so make sure it's initialized only once.
dev0
Saúl Ibarra Corretgé 6 months ago
parent
commit
4ef3987428
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      JitsiMediaDevices.js

+ 6
- 0
JitsiMediaDevices.js View File

@@ -19,6 +19,7 @@ class JitsiMediaDevices extends Listenable {
19 19
      */
20 20
     constructor() {
21 21
         super();
22
+        this._initialized = false;
22 23
         this._permissions = {};
23 24
     }
24 25
 
@@ -26,6 +27,11 @@ class JitsiMediaDevices extends Listenable {
26 27
      * Initialize. Start listening for device changes and initialize permissions checks.
27 28
      */
28 29
     init() {
30
+        if (this._initialized) {
31
+            return;
32
+        }
33
+        this._initialized = true;
34
+
29 35
         RTC.addListener(
30 36
             RTCEvents.DEVICE_LIST_CHANGED,
31 37
             devices =>

Loading…
Cancel
Save