0

Please provide the following:

SDK Version: 48 Platforms(Android/iOS/web/all): Android Expo Audio / expo AV I have a problem only on Android. I set up a sound with a link to an audio stream, when it goes to the background it just plays for 4 minutes and then stops. How to increase this execution time or how to keep it active while the player is playing?

I tried using the expo notification to see if the notification does not suspend the app. I tried to put in the app.json in the android tag

"permissions": [

    "FOREGROUND_SERVICE",

    "WAKE_LOCK"

  ],

but it didn't work.

I'm using Managed WorkFlow from expo

async function playSound() {
    try {
      setload(true)
      const { sound } = await Audio.Sound.createAsync({ uri: radioLink });
      sound.setVolumeAsync(1.0);
      setSoundState(sound)
      
      await Audio.setIsEnabledAsync(true);
      await Audio.setAudioModeAsync({
        staysActiveInBackground: true,
        allowsRecordingIOS: false,
        interruptionModeIOS: InterruptionModeIOS.DoNotMix,
        playsInSilentModeIOS: true,
        interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
        shouldDuckAndroid: true,
        playThroughEarpieceAndroid: false,
      });
      
      await sound.playAsync()
      console.log('Play Audio context');
      
      setload(false)
    } catch (error) {
      console.log('Error playing sound', error);
    }
  }

0 Answers0