A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(app): apply the screen share audio toggle to the surface being shared (#1813)
Hampus85a03a9e395c
diff --git a/fluxer_app/src/features/voice/components/StreamSettingsMenuContent.tsx b/fluxer_app/src/features/voice/components/StreamSettingsMenuContent.tsxindex a28a7cac5..4c6548292 100644--- a/fluxer_app/src/features/voice/components/StreamSettingsMenuContent.tsx+++ b/fluxer_app/src/features/voice/components/StreamSettingsMenuContent.tsx@@ -327,11 +327,17 @@ export async function pushActiveStreamSettings(interface StreamSettingsMenuContentProps {applyToLiveStream?: boolean;shareContext?: StreamSettingsShareContext;+ shareContextResolved?: boolean;displayShareEnvironment: DisplayShareEnvironment;}export const StreamSettingsMenuContent = observer(- ({applyToLiveStream = true, shareContext = 'display', displayShareEnvironment}: StreamSettingsMenuContentProps) => {+ ({+ applyToLiveStream = true,+ shareContext = 'display',+ shareContextResolved = true,+ displayShareEnvironment,+ }: StreamSettingsMenuContentProps) => {const {i18n} = useLingui();useMediaEngineVersion();const hasHigherVideoQuality = useHasHigherVideoQuality();@@ -511,16 +517,22 @@ export const StreamSettingsMenuContent = observer();const handleCaptureAudioToggle = useCallback((checked: boolean) => {- if (isAppShare) {- VoiceSettingsCommands.update({shareAppAudio: checked, muteStreamAudio: !checked});- } else if (isDeviceShare) {+ if (isDeviceShare) {VoiceSettingsCommands.update({shareDeviceAudio: checked, muteStreamAudio: !checked});+ } else if (!shareContextResolved) {+ VoiceSettingsCommands.update({+ shareAppAudio: checked,+ shareDesktopAudio: checked,+ muteStreamAudio: !checked,+ });+ } else if (isAppShare) {+ VoiceSettingsCommands.update({shareAppAudio: checked, muteStreamAudio: !checked});} else {VoiceSettingsCommands.update({shareDesktopAudio: checked, muteStreamAudio: !checked});}runApply({audioSettingsChanged: true});},- [isAppShare, isDeviceShare, runApply],+ [isAppShare, isDeviceShare, shareContextResolved, runApply],);const handleHidePreviewToggle = useCallback((checked: boolean) => {VoiceSettingsCommands.update({hideStreamPreview: checked});diff --git a/fluxer_app/src/features/voice/components/VoiceControlBar.tsx b/fluxer_app/src/features/voice/components/VoiceControlBar.tsxindex e65c36ab6..927a6b714 100644--- a/fluxer_app/src/features/voice/components/VoiceControlBar.tsx+++ b/fluxer_app/src/features/voice/components/VoiceControlBar.tsx@@ -400,6 +400,7 @@ const VoiceControlBarInner = observer(function VoiceControlBarInner() {applyToLiveStream={isScreenShareEnabled}displayShareEnvironment={displayShareEnvironment}shareContext={ActiveScreenShareSource.getSourceId()?.startsWith('window:') ? 'app' : 'display'}+ shareContextResolved={ActiveScreenShareSource.getSourceId() != null}data-flx="voice.voice-control-bar.render-screen-share-menu.stream-settings-menu-content"/><MenuGroup data-flx="voice.voice-control-bar.render-screen-share-menu.menu-group--2">diff --git a/fluxer_app/src/features/voice/utils/ScreenShareStartFlow.ts b/fluxer_app/src/features/voice/utils/ScreenShareStartFlow.tsindex a82cb7793..899310704 100644--- a/fluxer_app/src/features/voice/utils/ScreenShareStartFlow.ts+++ b/fluxer_app/src/features/voice/utils/ScreenShareStartFlow.ts@@ -291,6 +291,14 @@ function getConfiguredScreenShareOptions(sourceId,preferredDisplaySurface,);+ if (!includeAudio && shareContext !== 'device' && supportsDesktopScreenShareAudioCapture()) {+ logger.info('Screen share audio not requested for this surface', {+ sourceId,+ preferredDisplaySurface,+ shareAppAudio: VoiceSettings.getShareAppAudio(),+ shareDesktopAudio: VoiceSettings.getShareDesktopAudio(),+ });+ }const {captureOptions, publishOptions} = buildScreenShareOptions({resolution,frameRate,