fix(conference.js): prevent multiple GUM calls on presenter unmute
Chain _mutePresenterVideo async calls in order to prevent calling GUM multiple times.
This commit is contained in:
parent
c2cf09a2ca
commit
f810483ff6
|
@ -130,6 +130,15 @@ const eventEmitter = new EventEmitter();
|
||||||
let room;
|
let room;
|
||||||
let connection;
|
let connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This promise is used for chaining mutePresenterVideo calls in order to avoid calling GUM multiple times if it takes
|
||||||
|
* a while to finish.
|
||||||
|
*
|
||||||
|
* @type {Promise<void>}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
let _prevMutePresenterVideo = Promise.resolve();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Logic to open a desktop picker put on the window global for
|
* Logic to open a desktop picker put on the window global for
|
||||||
* lib-jitsi-meet to detect and invoke
|
* lib-jitsi-meet to detect and invoke
|
||||||
|
@ -447,6 +456,7 @@ export default {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The local presenter video track (if any).
|
* The local presenter video track (if any).
|
||||||
|
* @type {JitsiLocalTrack|null}
|
||||||
*/
|
*/
|
||||||
localPresenterVideo: null,
|
localPresenterVideo: null,
|
||||||
|
|
||||||
|
@ -858,7 +868,10 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSharingScreen) {
|
if (this.isSharingScreen) {
|
||||||
return this._mutePresenterVideo(mute);
|
// Chain _mutePresenterVideo calls
|
||||||
|
_prevMutePresenterVideo = _prevMutePresenterVideo.then(() => this._mutePresenterVideo(mute));
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not ready to modify track's state yet adjust the base/media
|
// If not ready to modify track's state yet adjust the base/media
|
||||||
|
@ -1636,6 +1649,15 @@ export default {
|
||||||
APP.store.dispatch(notifyCameraError(error));
|
APP.store.dispatch(notifyCameraError(error));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check for NO-OP
|
||||||
|
if (mute && (!this.localPresenterVideo || this.localPresenterVideo.isMuted())) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
} else if (!mute && this.localPresenterVideo && !this.localPresenterVideo.isMuted()) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.localPresenterVideo && !mute) {
|
if (!this.localPresenterVideo && !mute) {
|
||||||
// create a new presenter track and apply the presenter effect.
|
// create a new presenter track and apply the presenter effect.
|
||||||
let { height } = this.localVideo.track.getSettings();
|
let { height } = this.localVideo.track.getSettings();
|
||||||
|
|
Loading…
Reference in New Issue