Pārlūkot izejas kodu

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 mēnešus atpakaļ
vecāks
revīzija
4ef3987428
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6
    0
      JitsiMediaDevices.js

+ 6
- 0
JitsiMediaDevices.js Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt