Browse Source

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

master
tmoldovan8x8 4 years ago
parent
commit
9ed1969f7e
No account linked to committer's email address

+ 7
- 0
react/features/base/flags/constants.js View File

@@ -6,6 +6,13 @@
6 6
  */
7 7
 export const ADD_PEOPLE_ENABLED = 'add-people.enabled';
8 8
 
9
+/**
10
+ * Flag indicating if the SDK should not require the audio focus.
11
+ * Used by apps that do not use Jitsi audio.
12
+ * Default: disabled (false)
13
+ */
14
+export const ANDROID_AUDIO_FOCUS_DISABLED = 'android.audio-focus.disabled';
15
+
9 16
 /**
10 17
  * Flag indicating if the audio mute button should be displayed.
11 18
  * Default: enabled (true).

+ 5
- 3
react/features/mobile/audio-mode/middleware.js View File

@@ -1,6 +1,5 @@
1 1
 // @flow
2
-
3
-import { NativeEventEmitter, NativeModules } from 'react-native';
2
+import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
4 3
 
5 4
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
6 5
 import { SET_AUDIO_ONLY } from '../../base/audio-only';
@@ -10,6 +9,7 @@ import {
10 9
     CONFERENCE_JOINED,
11 10
     getCurrentConference
12 11
 } from '../../base/conference';
12
+import { getFeatureFlag, ANDROID_AUDIO_FOCUS_DISABLED } from '../../base/flags';
13 13
 import { MiddlewareRegistry } from '../../base/redux';
14 14
 
15 15
 import { _SET_AUDIOMODE_DEVICES, _SET_AUDIOMODE_SUBSCRIPTIONS } from './actionTypes';
@@ -140,7 +140,9 @@ function _updateAudioMode({ getState }, next, action) {
140 140
     const { enabled: audioOnly } = state['features/base/audio-only'];
141 141
     let mode;
142 142
 
143
-    if (conference) {
143
+    if (Platform.OS === 'android' && getFeatureFlag(state, ANDROID_AUDIO_FOCUS_DISABLED, false)) {
144
+        mode = AudioMode.DEFAULT;
145
+    } else if (conference) {
144 146
         mode = audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL;
145 147
     } else {
146 148
         mode = AudioMode.DEFAULT;

Loading…
Cancel
Save