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
  */
7
 export const ADD_PEOPLE_ENABLED = 'add-people.enabled';
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
  * Flag indicating if the audio mute button should be displayed.
17
  * Flag indicating if the audio mute button should be displayed.
11
  * Default: enabled (true).
18
  * Default: enabled (true).

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

1
 // @flow
1
 // @flow
2
-
3
-import { NativeEventEmitter, NativeModules } from 'react-native';
2
+import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
4
 
3
 
5
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
4
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app';
6
 import { SET_AUDIO_ONLY } from '../../base/audio-only';
5
 import { SET_AUDIO_ONLY } from '../../base/audio-only';
10
     CONFERENCE_JOINED,
9
     CONFERENCE_JOINED,
11
     getCurrentConference
10
     getCurrentConference
12
 } from '../../base/conference';
11
 } from '../../base/conference';
12
+import { getFeatureFlag, ANDROID_AUDIO_FOCUS_DISABLED } from '../../base/flags';
13
 import { MiddlewareRegistry } from '../../base/redux';
13
 import { MiddlewareRegistry } from '../../base/redux';
14
 
14
 
15
 import { _SET_AUDIOMODE_DEVICES, _SET_AUDIOMODE_SUBSCRIPTIONS } from './actionTypes';
15
 import { _SET_AUDIOMODE_DEVICES, _SET_AUDIOMODE_SUBSCRIPTIONS } from './actionTypes';
140
     const { enabled: audioOnly } = state['features/base/audio-only'];
140
     const { enabled: audioOnly } = state['features/base/audio-only'];
141
     let mode;
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
         mode = audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL;
146
         mode = audioOnly ? AudioMode.AUDIO_CALL : AudioMode.VIDEO_CALL;
145
     } else {
147
     } else {
146
         mode = AudioMode.DEFAULT;
148
         mode = AudioMode.DEFAULT;

Loading…
Cancel
Save