[Android] Add support for USB headset detection

The API to gather these was introduced in API level 26.
pull/3035/head jitsi-meet_3079
Saúl Ibarra Corretgé 7 years ago
parent 4bb6e5aefd
commit c8c198b0b1
  1. 10
      android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java

@ -72,13 +72,20 @@ class AudioModeModule extends ReactContextBaseJavaModule {
private static final int VIDEO_CALL = 2;
/**
*
* Constant defining the action for plugging in a headset. This is used on
* our device detection system for API < 23.
*/
private static final String ACTION_HEADSET_PLUG
= (Build.VERSION.SDK_INT >= 21)
? AudioManager.ACTION_HEADSET_PLUG
: Intent.ACTION_HEADSET_PLUG;
/**
* Constant defining a USB headset. Only available on API level >= 26.
* The value of: AudioDeviceInfo.TYPE_USB_HEADSET
*/
private static final int TYPE_USB_HEADSET = 22;
/**
* The name of {@code AudioModeModule} to be used in the React Native
* bridge.
@ -133,6 +140,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
break;
case AudioDeviceInfo.TYPE_WIRED_HEADPHONES:
case AudioDeviceInfo.TYPE_WIRED_HEADSET:
case TYPE_USB_HEADSET:
devices.add(DEVICE_HEADPHONES);
break;
}

Loading…
Cancel
Save