From 68f6cb33d41d5312e298f34648c7751f2b660504 Mon Sep 17 00:00:00 2001 From: Anna Olak <15946812+anna1901@users.noreply.github.com> Date: Thu, 22 Jan 2026 13:18:45 +0100 Subject: [PATCH 1/5] Apply default audio filters --- packages/mobile-client/src/constraints.ts | 52 +++++++++++++++++++++++ packages/mobile-client/src/index.ts | 13 ++++++ 2 files changed, 65 insertions(+) create mode 100644 packages/mobile-client/src/constraints.ts diff --git a/packages/mobile-client/src/constraints.ts b/packages/mobile-client/src/constraints.ts new file mode 100644 index 00000000..e16bda75 --- /dev/null +++ b/packages/mobile-client/src/constraints.ts @@ -0,0 +1,52 @@ +/** + * Google-specific audio processing constraints (legacy Chrome constraints). + * These are not part of the standard MediaTrackConstraints type but are supported by WebRTC implementations. + */ +interface GoogleAudioConstraints { + googEchoCancellation?: string | boolean; + googAutoGainControl?: string | boolean; + googNoiseSuppression?: string | boolean; + googTypingNoiseDetection?: string | boolean; + googHighpassFilter?: string | boolean; +} + +/** + * Extended MediaTrackConstraints that includes Google-specific audio processing properties. + */ +type ExtendedMediaTrackConstraints = MediaTrackConstraints & GoogleAudioConstraints; + +/** + * Default audio constraints for mobile-client with Google audio processing features enabled. + * These constraints can be overridden by passing custom audio constraints to FishjamProvider. + */ +export const DEFAULT_MOBILE_AUDIO_CONSTRAINTS: ExtendedMediaTrackConstraints = { + googEchoCancellation: "true", + googAutoGainControl: "true", + googNoiseSuppression: "true", + googTypingNoiseDetection: "true", + googHighpassFilter: "true", +}; + +/** + * Merges default mobile audio constraints with user-provided constraints. + * User-provided constraints take precedence over defaults. + * + * @param userConstraints - User-provided audio constraints (can be boolean or MediaTrackConstraints) + * @returns Merged audio constraints + */ +export function mergeMobileAudioConstraints( + userConstraints?: ExtendedMediaTrackConstraints | boolean, +): ExtendedMediaTrackConstraints | boolean { + if (userConstraints === false) { + return false; + } + + if (userConstraints === true || userConstraints === undefined) { + return DEFAULT_MOBILE_AUDIO_CONSTRAINTS; + } + + return { + ...DEFAULT_MOBILE_AUDIO_CONSTRAINTS, + ...userConstraints, + }; +} diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 3a35a753..1f74b869 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -11,7 +11,10 @@ import { useMicrophone as useMicrophoneReactClient } from '@fishjam-cloud/react-client'; +import { mergeMobileAudioConstraints } from './constraints'; + export { RTCView, RTCPIPView, type RTCVideoViewProps, type RTCPIPViewProps } from './overrides/RTCView'; + export { ScreenCapturePickerView, startPIP, @@ -25,6 +28,8 @@ export type { CallKitAction, CallKitConfig, MediaStream } from '@fishjam-cloud/r export { useForegroundService, type ForegroundServiceConfig } from './useForegroundService'; +export { DEFAULT_MOBILE_AUDIO_CONSTRAINTS } from './constraints'; + export { useCamera, useInitializeDevices, @@ -85,8 +90,16 @@ export type { // persistLastDevice is not supported on mobile export type FishjamProviderProps = Omit; export function FishjamProvider(props: FishjamProviderProps) { + const mergedConstraints = React.useMemo(() => { + return { + ...props.constraints, + audio: mergeMobileAudioConstraints(props.constraints?.audio), + }; + }, [props.constraints]); + return React.createElement(ReactClientFishjamProvider, { ...props, + constraints: mergedConstraints, persistLastDevice: false, }); } From 695141f18c5f206524e74eb8ed9699babc1eba9a Mon Sep 17 00:00:00 2001 From: Anna Olak <15946812+anna1901@users.noreply.github.com> Date: Thu, 22 Jan 2026 14:56:43 +0100 Subject: [PATCH 2/5] fix linting --- packages/mobile-client/src/constraints.ts | 10 +++++----- packages/mobile-client/src/index.ts | 7 +++++-- packages/mobile-client/src/useForegroundService.ts | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/mobile-client/src/constraints.ts b/packages/mobile-client/src/constraints.ts index e16bda75..7d84fb87 100644 --- a/packages/mobile-client/src/constraints.ts +++ b/packages/mobile-client/src/constraints.ts @@ -20,11 +20,11 @@ type ExtendedMediaTrackConstraints = MediaTrackConstraints & GoogleAudioConstrai * These constraints can be overridden by passing custom audio constraints to FishjamProvider. */ export const DEFAULT_MOBILE_AUDIO_CONSTRAINTS: ExtendedMediaTrackConstraints = { - googEchoCancellation: "true", - googAutoGainControl: "true", - googNoiseSuppression: "true", - googTypingNoiseDetection: "true", - googHighpassFilter: "true", + googEchoCancellation: 'true', + googAutoGainControl: 'true', + googNoiseSuppression: 'true', + googTypingNoiseDetection: 'true', + googHighpassFilter: 'true', }; /** diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 1f74b869..cdc7931b 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -8,7 +8,7 @@ import React from 'react'; import { FishjamProvider as ReactClientFishjamProvider, type FishjamProviderProps as ReactClientFishjamProviderProps, - useMicrophone as useMicrophoneReactClient + useMicrophone as useMicrophoneReactClient, } from '@fishjam-cloud/react-client'; import { mergeMobileAudioConstraints } from './constraints'; @@ -46,7 +46,10 @@ export { Variant, } from '@fishjam-cloud/react-client'; -export const useMicrophone = useMicrophoneReactClient as () => Omit< ReturnType, 'toggleMicrophoneMute' > +export const useMicrophone = useMicrophoneReactClient as () => Omit< + ReturnType, + 'toggleMicrophoneMute' +>; export type { UseInitializeDevicesParams, diff --git a/packages/mobile-client/src/useForegroundService.ts b/packages/mobile-client/src/useForegroundService.ts index d3009c0d..5ee1b093 100644 --- a/packages/mobile-client/src/useForegroundService.ts +++ b/packages/mobile-client/src/useForegroundService.ts @@ -2,7 +2,7 @@ import { useForegroundService as externalUseForegroundService } from '@fishjam-c /** * Configuration options for foreground service permissions. - * + * * A type representing the configuration for foreground service permissions. */ export type ForegroundServiceConfig = { @@ -38,10 +38,10 @@ export type ForegroundServiceConfig = { /** * Hook for managing a foreground service on Android. - * + * * A hook for managing a foreground service on Android. Does nothing on other platforms. * You can use this hook to keep your app running in the background. You're also required to run a foreground service when screen sharing. - * + * * @param config - Configuration options for the foreground service. */ export const useForegroundService = externalUseForegroundService; From 7819b31d0e9df6466b5cf2e9090d7257996ff940 Mon Sep 17 00:00:00 2001 From: Anna Olak Date: Thu, 22 Jan 2026 17:12:05 +0100 Subject: [PATCH 3/5] Change default values to boolean Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/mobile-client/src/constraints.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/mobile-client/src/constraints.ts b/packages/mobile-client/src/constraints.ts index 7d84fb87..dbd2fd04 100644 --- a/packages/mobile-client/src/constraints.ts +++ b/packages/mobile-client/src/constraints.ts @@ -20,11 +20,11 @@ type ExtendedMediaTrackConstraints = MediaTrackConstraints & GoogleAudioConstrai * These constraints can be overridden by passing custom audio constraints to FishjamProvider. */ export const DEFAULT_MOBILE_AUDIO_CONSTRAINTS: ExtendedMediaTrackConstraints = { - googEchoCancellation: 'true', - googAutoGainControl: 'true', - googNoiseSuppression: 'true', - googTypingNoiseDetection: 'true', - googHighpassFilter: 'true', + googEchoCancellation: true, + googAutoGainControl: true, + googNoiseSuppression: true, + googTypingNoiseDetection: true, + googHighpassFilter: true, }; /** From b5090472e387bbed6a5f208a8445af7155395136 Mon Sep 17 00:00:00 2001 From: Anna Olak <15946812+anna1901@users.noreply.github.com> Date: Thu, 22 Jan 2026 17:14:34 +0100 Subject: [PATCH 4/5] Fix documentation and deps --- packages/mobile-client/src/constraints.ts | 2 +- packages/mobile-client/src/index.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/mobile-client/src/constraints.ts b/packages/mobile-client/src/constraints.ts index 7d84fb87..f6247c8b 100644 --- a/packages/mobile-client/src/constraints.ts +++ b/packages/mobile-client/src/constraints.ts @@ -13,7 +13,7 @@ interface GoogleAudioConstraints { /** * Extended MediaTrackConstraints that includes Google-specific audio processing properties. */ -type ExtendedMediaTrackConstraints = MediaTrackConstraints & GoogleAudioConstraints; +export type ExtendedMediaTrackConstraints = MediaTrackConstraints & GoogleAudioConstraints; /** * Default audio constraints for mobile-client with Google audio processing features enabled. diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index cdc7931b..5fc7cc6c 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -29,6 +29,7 @@ export type { CallKitAction, CallKitConfig, MediaStream } from '@fishjam-cloud/r export { useForegroundService, type ForegroundServiceConfig } from './useForegroundService'; export { DEFAULT_MOBILE_AUDIO_CONSTRAINTS } from './constraints'; +export type { ExtendedMediaTrackConstraints } from './constraints'; export { useCamera, @@ -98,7 +99,7 @@ export function FishjamProvider(props: FishjamProviderProps) { ...props.constraints, audio: mergeMobileAudioConstraints(props.constraints?.audio), }; - }, [props.constraints]); + }, [props.constraints?.audio, props.constraints?.video]); return React.createElement(ReactClientFishjamProvider, { ...props, From d4a8bafbe4849f6348241cb8e46198abc02fbd2d Mon Sep 17 00:00:00 2001 From: Anna Olak <15946812+anna1901@users.noreply.github.com> Date: Fri, 23 Jan 2026 09:02:34 +0100 Subject: [PATCH 5/5] Remove unneeded exports --- packages/mobile-client/src/index.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/mobile-client/src/index.ts b/packages/mobile-client/src/index.ts index 5fc7cc6c..ae6da98d 100644 --- a/packages/mobile-client/src/index.ts +++ b/packages/mobile-client/src/index.ts @@ -28,9 +28,6 @@ export type { CallKitAction, CallKitConfig, MediaStream } from '@fishjam-cloud/r export { useForegroundService, type ForegroundServiceConfig } from './useForegroundService'; -export { DEFAULT_MOBILE_AUDIO_CONSTRAINTS } from './constraints'; -export type { ExtendedMediaTrackConstraints } from './constraints'; - export { useCamera, useInitializeDevices,