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.
This commit is contained in:
damencho 2016-11-09 16:34:01 -06:00
parent 96b280668d
commit 82926ef8c6
1 changed files with 28 additions and 3 deletions

View File

@ -1283,6 +1283,30 @@ export default {
// FIXME close // 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) => { room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => {
APP.UI.updateDTMFSupport(isDTMFSupported); APP.UI.updateDTMFSupport(isDTMFSupported);
}); });
@ -1617,11 +1641,12 @@ export default {
APP.UI.onAvailableDevicesChanged(devices); APP.UI.onAvailableDevicesChanged(devices);
}); });
this.deviceChangeListener = (devices) =>
window.setTimeout(
() => this._onDeviceListChanged(devices), 0);
JitsiMeetJS.mediaDevices.addEventListener( JitsiMeetJS.mediaDevices.addEventListener(
JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED, JitsiMeetJS.events.mediaDevices.DEVICE_LIST_CHANGED,
(devices) => this.deviceChangeListener);
window.setTimeout(
() => this._onDeviceListChanged(devices), 0));
} }
}, },
/** /**