Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fix stop everyone's video
robertpin41c38427c181
diff --git a/conference.js b/conference.jsindex 68737e6c08..32a89eee7c 100644--- a/conference.js+++ b/conference.js@@ -1503,14 +1503,14 @@ export default {** @param {boolean} didHaveVideo indicates if there was a camera video being* used, before switching to screen sharing.- * @param {boolean} wasVideoMuted indicates if the video was muted, before- * switching to screen sharing.+ * @param {boolean} ignoreDidHaveVideo indicates if the camera video should be+ * ignored when switching screen sharing off.* @return {Promise} resolved after the screen sharing is turned off, or* rejected with some error (no idea what kind of error, possible GUM error)* in case it fails.* @private*/- async _turnScreenSharingOff(didHaveVideo) {+ async _turnScreenSharingOff(didHaveVideo, ignoreDidHaveVideo) {this._untoggleScreenSharing = null;this.videoSwitchInProgress = true;@@ -1554,7 +1554,7 @@ export default {APP.store.dispatch(setScreenAudioShareState(false));- if (didHaveVideo) {+ if (didHaveVideo && !ignoreDidHaveVideo) {promise = promise.then(() => createLocalTracksF({ devices: [ 'video' ] })).then(([ stream ]) => {logger.debug(`_turnScreenSharingOff using ${stream} for useVideoStream`);@@ -1605,9 +1605,10 @@ export default {* @param {Array<string>} [options.desktopSharingSources] - Array with the* sources that have to be displayed in the desktop picker window ('screen',* 'window', etc.).+ * @param {boolean} ignoreDidHaveVideo - if true ignore if video was on when sharing started.* @return {Promise.<T>}*/- async toggleScreenSharing(toggle = !this._untoggleScreenSharing, options = {}) {+ async toggleScreenSharing(toggle = !this._untoggleScreenSharing, options = {}, ignoreDidHaveVideo) {logger.debug(`toggleScreenSharing: ${toggle}`);if (this.videoSwitchInProgress) {return Promise.reject('Switch in progress.');@@ -1633,7 +1634,7 @@ export default {}return this._untoggleScreenSharing- ? this._untoggleScreenSharing()+ ? this._untoggleScreenSharing(ignoreDidHaveVideo): Promise.resolve();},@@ -2476,8 +2477,8 @@ export default {});APP.UI.addListener(- UIEvents.TOGGLE_SCREENSHARING, ({ enabled, audioOnly }) => {- this.toggleScreenSharing(enabled, { audioOnly });+ UIEvents.TOGGLE_SCREENSHARING, ({ enabled, audioOnly, ignoreDidHaveVideo }) => {+ this.toggleScreenSharing(enabled, { audioOnly }, ignoreDidHaveVideo);});},diff --git a/react/features/base/tracks/actions.js b/react/features/base/tracks/actions.jsindex dc8541e761..3c73506ddf 100644--- a/react/features/base/tracks/actions.js+++ b/react/features/base/tracks/actions.js@@ -258,17 +258,20 @@ export function showNoDataFromSourceVideoError(jitsiTrack) {** @param {boolean} enabled - The state to toggle screen sharing to.* @param {boolean} audioOnly - Only share system audio.+ * @param {boolean} ignoreDidHaveVideo - Wether or not to ignore if video was on when sharing started.* @returns {{* type: TOGGLE_SCREENSHARING,* on: boolean,- * audioOnly: boolean+ * audioOnly: boolean,+ * ignoreDidHaveVideo: boolean* }}*/-export function toggleScreensharing(enabled, audioOnly = false) {+export function toggleScreensharing(enabled, audioOnly = false, ignoreDidHaveVideo = false) {return {type: TOGGLE_SCREENSHARING,enabled,- audioOnly+ audioOnly,+ ignoreDidHaveVideo};}diff --git a/react/features/base/tracks/middleware.js b/react/features/base/tracks/middleware.jsindex 7f6bf3f7a3..56b8871795 100644--- a/react/features/base/tracks/middleware.js+++ b/react/features/base/tracks/middleware.js@@ -149,10 +149,11 @@ MiddlewareRegistry.register(store => next => action => {return;}- const { enabled, audioOnly } = action;+ const { enabled, audioOnly, ignoreDidHaveVideo } = action;APP.UI.emitEvent(UIEvents.TOGGLE_SCREENSHARING, { enabled,- audioOnly });+ audioOnly,+ ignoreDidHaveVideo });}break;diff --git a/react/features/video-menu/actions.any.js b/react/features/video-menu/actions.any.jsindex f272c95111..5d4b835fe5 100644--- a/react/features/video-menu/actions.any.js+++ b/react/features/video-menu/actions.any.js@@ -23,6 +23,7 @@ import {getRemoteParticipants,muteRemoteParticipant} from '../base/participants';+import { toggleScreensharing } from '../base/tracks';import { isModerationNotificationDisplayed } from '../notifications';declare var APP: Object;@@ -55,6 +56,10 @@ export function muteLocal(enable: boolean, mediaType: MEDIA_TYPE) {return;}+ if (enable) {+ dispatch(toggleScreensharing(false, false, true));+ }+sendAnalytics(createToolbarEvent(isAudio ? AUDIO_MUTE : VIDEO_MUTE, { enable }));dispatch(isAudio ? setAudioMuted(enable, /* ensureTrack */ true): setVideoMuted(enable, mediaType, VIDEO_MUTISM_AUTHORITY.USER, /* ensureTrack */ true));