Switch audio output between earpiece and headphones in react-native

Hello world…

I’m currently working in a project built in react-native and I’m using video sdk, I just need to know is there and option that let’s you switch audio output between earpiece and headphones (I can detect is my device connected to the headphones via bluetooth), I’ll be thankful if somebody help!

here is a part of code about how I generate speaker and silence mode

  //? set audio output
  useEffect(() => {
    if (audioOutput === 'speaker') {
      zoom.audioHelper.startAudio();
      zoom.audioHelper.setSpeaker(true);
    } else if (audioOutput === 'silence') {
      zoom.audioHelper.setSpeaker(false);
      zoom.audioHelper.stopAudio();
    } else if (audioOutput === 'earpiece') {
      zoom.audioHelper.startAudio();
      zoom.audioHelper.setSpeaker(false);
      // I need something here to force earpiece output instead of headphones even if my device is connected a headphones
    } else if (audioOutput === 'bluetooth') {
      zoom.audioHelper.startAudio();
      zoom.audioHelper.setSpeaker(false);
    }
  }, [audioOutput]);

This topic was automatically closed after 30 days. New replies are no longer allowed.