Sfoglia il codice sorgente

Detects suspended event, stops local video and shows overlay.

Also removes device change listener, cause when PC wakeups devices will be reconnected and we can try open the local video again.
master
damencho 8 anni fa
parent
commit
82926ef8c6
1 ha cambiato i file con 28 aggiunte e 3 eliminazioni
  1. 28
    3
      conference.js

+ 28
- 3
conference.js Vedi File

@@ -1283,6 +1283,30 @@ export default {
1283 1283
             // FIXME close
1284 1284
         });
1285 1285
 
1286
+        room.on(ConferenceEvents.SUSPEND_DETECTED, () => {
1287
+            // After wake up, we will be in a state where conference is left
1288
+            // there will be dialog shown to user.
1289
+            // We do not want video/audio as we show an overlay and after it
1290
+            // user need to rejoin or close, while waking up we can detect
1291
+            // camera wakeup as a problem with device.
1292
+            // We also do not care about device change, which happens
1293
+            // on resume after suspending PC.
1294
+            if (this.deviceChangeListener)
1295
+                JitsiMeetJS.mediaDevices.removeEventListener(
1296
+                    JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
1297
+                    this.deviceChangeListener);
1298
+
1299
+            // stop local video
1300
+            if (localVideo)
1301
+                localVideo.dispose();
1302
+            // stop local audio
1303
+            if (localAudio)
1304
+                localAudio.dispose();
1305
+
1306
+            // show overlay
1307
+            APP.UI.showSuspendedOverlay();
1308
+        });
1309
+
1286 1310
         room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => {
1287 1311
             APP.UI.updateDTMFSupport(isDTMFSupported);
1288 1312
         });
@@ -1617,11 +1641,12 @@ export default {
1617 1641
                 APP.UI.onAvailableDevicesChanged(devices);
1618 1642
             });
1619 1643
 
1644
+            this.deviceChangeListener = (devices) =>
1645
+                window.setTimeout(
1646
+                    () => this._onDeviceListChanged(devices), 0);
1620 1647
             JitsiMeetJS.mediaDevices.addEventListener(
1621 1648
                 JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
1622
-                (devices) =>
1623
-                    window.setTimeout(
1624
-                        () => this._onDeviceListChanged(devices), 0));
1649
+                this.deviceChangeListener);
1625 1650
         }
1626 1651
     },
1627 1652
     /**

Loading…
Annulla
Salva