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 {
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});
@@ -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">
@@ -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,