Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(android) adds ability to disable the requestFocus on Android

tmoldovan8x89ed1969f7ee1
diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js
index 8f485dd767..777cc40fc0 100644
--- a/react/features/base/flags/constants.js
+++ b/react/features/base/flags/constants.js
@@ -6,6 +6,13 @@
*/
export const ADD_PEOPLE_ENABLED = 'add-people.enabled';
+/**
+ * Flag indicating if the SDK should not require the audio focus.
+ * Used by apps that do not use Jitsi audio.
+ * Default: disabled (false)
+ */
+export const ANDROID_AUDIO_FOCUS_DISABLED = 'android.audio-focus.disabled';
+
/**
* Flag indicating if the audio mute button should be displayed.
* Default: enabled (true).
diff --git a/react/features/mobile/audio-mode/middleware.js b/react/features/mobile/audio-mode/middleware.js
index 189870ec32..2ed61c19f1 100644
--- a/react/features/mobile/audio-mode/middleware.js
+++ b/react/features/mobile/audio-mode/middleware.js
@@ -1,6 +1,5 @@
// @flow
-
-import { NativeEventEmitter, NativeModules } from 'react-native';
+import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
import { SET_AUDIO_ONLY } from '../../base/audio-only';
@@ -10,6 +9,7 @@ import {
CONFERENCE_JOINED,
getCurrentConference
} from '../../base/conference';
+import { getFeatureFlag, ANDROID_AUDIO_FOCUS_DISABLED } from '../../base/flags';
import { MiddlewareRegistry } from '../../base/redux';
import { _SET_AUDIOMODE_DEVICES, _SET_AUDIOMODE_SUBSCRIPTIONS } from './actionTypes';
@@ -140,7 +140,9 @@ function _updateAudioMode({ getState }, next, action) {
const { enabled: audioOnly } = state['features/base/audio-only'];
let mode;
- if (conference) {
+ if (Platform.OS === 'android' && getFeatureFlag(state, ANDROID_AUDIO_FOCUS_DISABLED, false)) {
+ mode = AudioMode.DEFAULT;
+ } else if (conference) {
mode = audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL;
} else {
mode = AudioMode.DEFAULT;