mirror of
https://github.com/fluxerapp/fluxer.git
synced 2026-09-02 21:04:06 +03:00
feat(voice): request web share audio via the browser picker (#2384)
This commit is contained in:
@@ -156,6 +156,32 @@ describe('buildScreenShareOptions', () => {
|
||||
frameRate: 30,
|
||||
});
|
||||
});
|
||||
it('offers the browser picker system audio for every surface when audio is requested', () => {
|
||||
const {captureOptions} = buildScreenShareOptions({
|
||||
resolution: 'medium',
|
||||
frameRate: 30,
|
||||
includeAudio: true,
|
||||
useBrowserAudioPicker: true,
|
||||
});
|
||||
expect(captureOptions).toMatchObject({
|
||||
audio: true,
|
||||
systemAudio: 'include',
|
||||
windowAudio: 'system',
|
||||
});
|
||||
});
|
||||
it('keeps the browser picker audio hints excluded when audio is not requested', () => {
|
||||
const {captureOptions} = buildScreenShareOptions({
|
||||
resolution: 'medium',
|
||||
frameRate: 30,
|
||||
includeAudio: false,
|
||||
useBrowserAudioPicker: true,
|
||||
});
|
||||
expect(captureOptions).toMatchObject({
|
||||
audio: false,
|
||||
systemAudio: 'exclude',
|
||||
windowAudio: 'exclude',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('forced screen share bitrate', () => {
|
||||
|
||||
@@ -92,6 +92,7 @@ export interface ScreenShareBuildConfig {
|
||||
height: number;
|
||||
};
|
||||
preferredDisplaySurface?: 'window' | 'monitor';
|
||||
useBrowserAudioPicker?: boolean;
|
||||
}
|
||||
|
||||
type ScreenShareVideoOptions = NonNullable<Exclude<ScreenShareCaptureOptions['video'], true>> & {
|
||||
@@ -150,8 +151,8 @@ export function buildScreenShareOptions(
|
||||
...(config.includeAudio ? {restrictOwnAudio: true} : {}),
|
||||
selfBrowserSurface: 'include',
|
||||
monitorTypeSurfaces: config.preferredDisplaySurface === 'window' ? 'exclude' : 'include',
|
||||
systemAudio: 'exclude',
|
||||
windowAudio: config.includeAudio ? 'window' : 'exclude',
|
||||
systemAudio: config.includeAudio && config.useBrowserAudioPicker ? 'include' : 'exclude',
|
||||
windowAudio: config.includeAudio ? (config.useBrowserAudioPicker ? 'system' : 'window') : 'exclude',
|
||||
resolution: {width, height, frameRate: resolvedFrameRate},
|
||||
video,
|
||||
},
|
||||
|
||||
@@ -202,6 +202,9 @@ function shouldIncludeAudioForShare(
|
||||
if (shareContext === 'device') {
|
||||
return VoiceSettings.getShareDeviceAudio();
|
||||
}
|
||||
if (displayShareEnvironment === 'web') {
|
||||
return supportsDesktopScreenShareAudioCapture();
|
||||
}
|
||||
if (sourceId?.startsWith('window:')) {
|
||||
return supportsDesktopScreenShareAudioCapture() && VoiceSettings.getShareAppAudio();
|
||||
}
|
||||
@@ -307,6 +310,7 @@ function getConfiguredScreenShareOptions(
|
||||
contentHint,
|
||||
sourceDimensions,
|
||||
preferredDisplaySurface,
|
||||
useBrowserAudioPicker: displayShareEnvironment === 'web',
|
||||
});
|
||||
publishOptions.videoCodec = preferredVideoCodec;
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user