fix(audio-share): Fix audio-only SS in multi-stream mode.

ShareAudioDialog passes undefined when the user hits continue in the share audio demo modal. Toggle state of audio-share based on the current state of audio share in that case.
This commit is contained in:
Jaya Allamsetty 2022-08-01 17:03:53 -04:00
parent 9b9fbc0bc9
commit d63e0c5ab6
3 changed files with 12 additions and 13 deletions

View File

@ -7,7 +7,7 @@ import {
setPrejoinPageVisibility, setPrejoinPageVisibility,
setSkipPrejoinOnReload setSkipPrejoinOnReload
} from '../../prejoin'; } from '../../prejoin';
import { setScreenAudioShareState, setScreenshareAudioTrack } from '../../screen-share'; import { isAudioOnlySharing, setScreenAudioShareState, setScreenshareAudioTrack } from '../../screen-share';
import { isScreenshotCaptureEnabled, toggleScreenshotCaptureSummary } from '../../screenshot-capture'; import { isScreenshotCaptureEnabled, toggleScreenshotCaptureSummary } from '../../screenshot-capture';
import { AudioMixerEffect } from '../../stream-effects/audio-mixer/AudioMixerEffect'; import { AudioMixerEffect } from '../../stream-effects/audio-mixer/AudioMixerEffect';
import { setAudioOnly } from '../audio-only'; import { setAudioOnly } from '../audio-only';
@ -134,11 +134,18 @@ async function _maybeApplyAudioMixerEffect(desktopAudioTrack, state) {
async function _toggleScreenSharing({ enabled, audioOnly = false }, store) { async function _toggleScreenSharing({ enabled, audioOnly = false }, store) {
const { dispatch, getState } = store; const { dispatch, getState } = store;
const state = getState(); const state = getState();
const audioOnlySharing = isAudioOnlySharing(state);
const conference = getCurrentConference(state); const conference = getCurrentConference(state);
const localAudio = getLocalJitsiAudioTrack(state); const localAudio = getLocalJitsiAudioTrack(state);
const localScreenshare = getLocalDesktopTrack(state['features/base/tracks']); const localScreenshare = getLocalDesktopTrack(state['features/base/tracks']);
if (enabled) { // ShareAudioDialog passes undefined when the user hits continue in the share audio demo modal. Audio screen-share
// state is toggled based on the current state of audio share in that case.
const enable = audioOnly
? enabled ?? !audioOnlySharing
: enabled;
if (enable) {
let tracks; let tracks;
try { try {
@ -210,6 +217,6 @@ async function _toggleScreenSharing({ enabled, audioOnly = false }, store) {
} }
if (audioOnly) { if (audioOnly) {
dispatch(setScreenAudioShareState(enabled)); dispatch(setScreenAudioShareState(enable));
} }
} }

View File

@ -1,6 +1,5 @@
// @flow // @flow
import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config/functions.any';
import { openDialog } from '../base/dialog/actions'; import { openDialog } from '../base/dialog/actions';
import { browser } from '../base/lib-jitsi-meet'; import { browser } from '../base/lib-jitsi-meet';
import { shouldHideShareAudioHelper } from '../base/settings'; import { shouldHideShareAudioHelper } from '../base/settings';
@ -86,12 +85,6 @@ export function startAudioScreenShareFlow() {
// available for audio screen sharing, namely full window audio. // available for audio screen sharing, namely full window audio.
// If we're already sharing audio, toggle off. // If we're already sharing audio, toggle off.
if (shouldHideShareAudioHelper(state) || browser.isElectron() || audioOnlySharing) { if (shouldHideShareAudioHelper(state) || browser.isElectron() || audioOnlySharing) {
if (getMultipleVideoSendingSupportFeatureFlag(state)) {
dispatch(toggleScreensharing(!audioOnlySharing, true));
return;
}
// We don't want to explicitly set the screens share state, by passing undefined we let the // We don't want to explicitly set the screens share state, by passing undefined we let the
// underlying logic decide if it's on or off. // underlying logic decide if it's on or off.
dispatch(toggleScreensharing(undefined, true)); dispatch(toggleScreensharing(undefined, true));

View File

@ -1,6 +1,6 @@
// @flow // @flow
import { getMultipleVideoSupportFeatureFlag } from '../base/config'; import { getMultipleVideoSendingSupportFeatureFlag } from '../base/config';
import { isWindows } from '../base/environment'; import { isWindows } from '../base/environment';
import { isMobileBrowser } from '../base/environment/utils'; import { isMobileBrowser } from '../base/environment/utils';
import { browser } from '../base/lib-jitsi-meet'; import { browser } from '../base/lib-jitsi-meet';
@ -57,8 +57,7 @@ export function isScreenVideoShared(state: Object) {
const tracks = state['features/base/tracks']; const tracks = state['features/base/tracks'];
const localScreenshare = getLocalDesktopTrack(tracks); const localScreenshare = getLocalDesktopTrack(tracks);
if (getMultipleVideoSupportFeatureFlag(state)) { if (getMultipleVideoSendingSupportFeatureFlag(state)) {
return localScreenshare && localScreenshare.jitsiTrack && !localScreenshare.jitsiTrack.isMuted(); return localScreenshare && localScreenshare.jitsiTrack && !localScreenshare.jitsiTrack.isMuted();
} }
const localVideo = getLocalVideoTrack(tracks); const localVideo = getLocalVideoTrack(tracks);