mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(app): share stream audio by default and reset the opt-out per stream (#1819)
This commit is contained in:
1 parent
14e772a751
commit
137edc7cfb
4 files changed
+35
-5
No files matched your search
@@ -2326,6 +2326,7 @@ class MediaEngineFacade extends Store {
|
||||
sendUpdate?: boolean;
|
||||
playSound?: boolean;
|
||||
restartIfEnabled?: boolean;
|
||||
preserveStreamAudioPreferences?: boolean;
|
||||
},
|
||||
publishOptions?: TrackPublishOptions,
|
||||
): Promise<void> {
|
||||
|
||||
+10
@@ -7,6 +7,7 @@ import {SoundType} from '@app/features/notification/utils/SoundUtils';
|
||||
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
|
||||
import * as SoundCommands from '@app/features/ui/commands/SoundCommands';
|
||||
import {getElectronAPI} from '@app/features/ui/utils/NativeUtils';
|
||||
import * as VoiceSettingsCommands from '@app/features/voice/commands/VoiceSettingsCommands';
|
||||
import {getStreamKey} from '@app/features/voice/components/StreamKeys';
|
||||
import AdaptiveScreenShareEngine from '@app/features/voice/engine/AdaptiveScreenShareEngine';
|
||||
import type {NegotiationReason} from '@app/features/voice/engine/ScreenShareCodecNegotiation';
|
||||
@@ -691,11 +692,20 @@ class VoiceEngineV2AppScreenShareExecutionAdapter extends Store {
|
||||
playSound?: boolean;
|
||||
restartIfEnabled?: boolean;
|
||||
reason?: string;
|
||||
preserveStreamAudioPreferences?: boolean;
|
||||
},
|
||||
publishOptions?: TrackPublishOptions,
|
||||
): Promise<void> {
|
||||
assert.equal(typeof enabled, 'boolean');
|
||||
await this.controllerRouting.setEnabled(room, enabled, options, publishOptions);
|
||||
if (!enabled && options?.preserveStreamAudioPreferences !== true) {
|
||||
VoiceSettingsCommands.update({
|
||||
shareAppAudio: true,
|
||||
shareDesktopAudio: true,
|
||||
shareDeviceAudio: true,
|
||||
muteStreamAudio: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async executeScreenShareSetEnabledDirect(
|
||||
|
||||
@@ -216,6 +216,18 @@ function applyScreenShareAudioConsentMigrationV1(parsed: Record<string, unknown>
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyScreenShareAudioDefaultOnMigrationV1(parsed: Record<string, unknown>): boolean {
|
||||
if (parsed.screenShareAudioDefaultOnMigratedV1 === true) {
|
||||
return false;
|
||||
}
|
||||
parsed.shareAppAudio = true;
|
||||
parsed.shareDesktopAudio = true;
|
||||
parsed.shareDeviceAudio = true;
|
||||
parsed.muteStreamAudio = false;
|
||||
parsed.screenShareAudioDefaultOnMigratedV1 = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyStreamingModeDefaultMigrationV1(parsed: Record<string, unknown>): boolean {
|
||||
if (parsed.streamingModeDefaultMigratedV1 === true) {
|
||||
return false;
|
||||
@@ -284,12 +296,13 @@ class VoiceSettings {
|
||||
streamingMode: StreamingMode = 'screenshare';
|
||||
streamingModeDefaultMigratedV1 = false;
|
||||
hideStreamPreview = false;
|
||||
muteStreamAudio = true;
|
||||
shareAppAudio = false;
|
||||
shareDesktopAudio = false;
|
||||
shareDeviceAudio = false;
|
||||
muteStreamAudio = false;
|
||||
shareAppAudio = true;
|
||||
shareDesktopAudio = true;
|
||||
shareDeviceAudio = true;
|
||||
screenShareAudioDeviceId = 'default';
|
||||
screenShareAudioConsentMigratedV1 = false;
|
||||
screenShareAudioDefaultOnMigratedV1 = false;
|
||||
outputVolumeRecalibratedV1 = false;
|
||||
backgroundImageId = NONE_BACKGROUND_ID;
|
||||
backgroundImages: Array<BackgroundImage> = [];
|
||||
@@ -424,6 +437,7 @@ class VoiceSettings {
|
||||
changed = applyPiPPopoutDefaultsMigration(parsed) || changed;
|
||||
changed = applyAdaptiveScreenShareQualityMigrationV2(parsed) || changed;
|
||||
changed = applyScreenShareAudioConsentMigrationV1(parsed) || changed;
|
||||
changed = applyScreenShareAudioDefaultOnMigrationV1(parsed) || changed;
|
||||
changed = applyStreamingModeDefaultMigrationV1(parsed) || changed;
|
||||
changed = applyOutputVolumeRecalibrationMigrationV1(parsed) || changed;
|
||||
if (changed) {
|
||||
@@ -463,6 +477,7 @@ class VoiceSettings {
|
||||
'shareDeviceAudio',
|
||||
'screenShareAudioDeviceId',
|
||||
'screenShareAudioConsentMigratedV1',
|
||||
'screenShareAudioDefaultOnMigratedV1',
|
||||
'outputVolumeRecalibratedV1',
|
||||
'backgroundImageId',
|
||||
'backgroundImages',
|
||||
|
||||
@@ -357,7 +357,11 @@ async function runConfiguredDisplayScreenShare(
|
||||
logger.warn('No active screen share to restart for Wayland portal source switch');
|
||||
return false;
|
||||
}
|
||||
await MediaEngine.setScreenShareEnabled(false, {sendUpdate: false, playSound: false});
|
||||
await MediaEngine.setScreenShareEnabled(false, {
|
||||
sendUpdate: false,
|
||||
playSound: false,
|
||||
preserveStreamAudioPreferences: true,
|
||||
});
|
||||
}
|
||||
let nativeAudioArmed = false;
|
||||
const isOwnWindowShare = options?.isOwnWindow === true && sourceId?.startsWith('window:');
|
||||
|
||||
Reference in new issue
Block a user