fix(app): apply the screen share audio toggle to the surface being shared (#1813)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-21 17:04:22 +02:00
1 parent 51ee6567b4
commit 85a03a9e39
3 files changed
+26 -5

No files matched your search

@@ -327,11 +327,17 @@ export async function pushActiveStreamSettings(
interface StreamSettingsMenuContentProps { interface StreamSettingsMenuContentProps {
applyToLiveStream?: boolean; applyToLiveStream?: boolean;
shareContext?: StreamSettingsShareContext; shareContext?: StreamSettingsShareContext;
shareContextResolved?: boolean;
displayShareEnvironment: DisplayShareEnvironment; displayShareEnvironment: DisplayShareEnvironment;
} }
export const StreamSettingsMenuContent = observer( export const StreamSettingsMenuContent = observer(
({applyToLiveStream = true, shareContext = 'display', displayShareEnvironment}: StreamSettingsMenuContentProps) => { ({
applyToLiveStream = true,
shareContext = 'display',
shareContextResolved = true,
displayShareEnvironment,
}: StreamSettingsMenuContentProps) => {
const {i18n} = useLingui(); const {i18n} = useLingui();
useMediaEngineVersion(); useMediaEngineVersion();
const hasHigherVideoQuality = useHasHigherVideoQuality(); const hasHigherVideoQuality = useHasHigherVideoQuality();
@@ -511,16 +517,22 @@ export const StreamSettingsMenuContent = observer(
); );
const handleCaptureAudioToggle = useCallback( const handleCaptureAudioToggle = useCallback(
(checked: boolean) => { (checked: boolean) => {
if (isAppShare) { if (isDeviceShare) {
VoiceSettingsCommands.update({shareAppAudio: checked, muteStreamAudio: !checked});
} else if (isDeviceShare) {
VoiceSettingsCommands.update({shareDeviceAudio: checked, muteStreamAudio: !checked}); 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 { } else {
VoiceSettingsCommands.update({shareDesktopAudio: checked, muteStreamAudio: !checked}); VoiceSettingsCommands.update({shareDesktopAudio: checked, muteStreamAudio: !checked});
} }
runApply({audioSettingsChanged: true}); runApply({audioSettingsChanged: true});
}, },
[isAppShare, isDeviceShare, runApply], [isAppShare, isDeviceShare, shareContextResolved, runApply],
); );
const handleHidePreviewToggle = useCallback((checked: boolean) => { const handleHidePreviewToggle = useCallback((checked: boolean) => {
VoiceSettingsCommands.update({hideStreamPreview: checked}); VoiceSettingsCommands.update({hideStreamPreview: checked});
@@ -400,6 +400,7 @@ const VoiceControlBarInner = observer(function VoiceControlBarInner() {
applyToLiveStream={isScreenShareEnabled} applyToLiveStream={isScreenShareEnabled}
displayShareEnvironment={displayShareEnvironment} displayShareEnvironment={displayShareEnvironment}
shareContext={ActiveScreenShareSource.getSourceId()?.startsWith('window:') ? 'app' : 'display'} 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" 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"> <MenuGroup data-flx="voice.voice-control-bar.render-screen-share-menu.menu-group--2">
@@ -291,6 +291,14 @@ function getConfiguredScreenShareOptions(
sourceId, sourceId,
preferredDisplaySurface, 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({ const {captureOptions, publishOptions} = buildScreenShareOptions({
resolution, resolution,
frameRate, frameRate,