diff --git a/conference.js b/conference.js index dd6016e12..e90754bde 100644 --- a/conference.js +++ b/conference.js @@ -1283,6 +1283,30 @@ export default { // FIXME close }); + room.on(ConferenceEvents.SUSPEND_DETECTED, () => { + // After wake up, we will be in a state where conference is left + // there will be dialog shown to user. + // We do not want video/audio as we show an overlay and after it + // user need to rejoin or close, while waking up we can detect + // camera wakeup as a problem with device. + // We also do not care about device change, which happens + // on resume after suspending PC. + if (this.deviceChangeListener) + JitsiMeetJS.mediaDevices.removeEventListener( + JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, + this.deviceChangeListener); + + // stop local video + if (localVideo) + localVideo.dispose(); + // stop local audio + if (localAudio) + localAudio.dispose(); + + // show overlay + APP.UI.showSuspendedOverlay(); + }); + room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => { APP.UI.updateDTMFSupport(isDTMFSupported); }); @@ -1617,11 +1641,12 @@ export default { APP.UI.onAvailableDevicesChanged(devices); }); + this.deviceChangeListener = (devices) => + window.setTimeout( + () => this._onDeviceListChanged(devices), 0); JitsiMeetJS.mediaDevices.addEventListener( JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, - (devices) => - window.setTimeout( - () => this._onDeviceListChanged(devices), 0)); + this.deviceChangeListener); } }, /**