3

Is it possible for Expo (managed workflow) to play new audio file in the background using expo-av?

According to this https://expo.canny.io/feature-requests/p/audio-playback-in-background feature request it is not possible.

However, looking at this post https://levelup.gitconnected.com/lessons-learned-building-multiple-apps-with-expo-and-react-native-28bd43b72b84 It states that the issue has been fixed:

"for example at one point it didn’t allow playing audio in the background, this was resolved in an SDK upgrade" (unless he is talking about same audio file finishing playing after the screen is locked).

(unless he meant just for the same file to finish playing).

The question is for a single audio file to finish and for the next audio file to be picked up while the app is in the background.

Not just to finish the audio file, which can be done with following configuration:

      const AUDIO_CONFIG = {
        interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS,
        playsInSilentModeIOS: true,
        interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS,
        shouldDuckAndroid: true,
        staysActiveInBackground: true,
      };

      await Audio.setAudioModeAsync(AUDIO_CONFIG);
user7858768
  • 838
  • 7
  • 22

0 Answers0