0

I am noticing some issues with Expo-AV after updating to SDK 45. I am using react-native with an expo managed project.

I am receiving this error when trying to pause the sound using sound.pauseAsync() :

[Unhandled promise rejection: Error: Encountered an exception while calling native method: Exception occurred while executing exported method setAudioMode on module ExponentAV: Player is accessed on the wrong thread. See https://exoplayer.dev/issues/player-accessed-on-wrong-thread]

Here is my setAudio code:

await Audio.setAudioModeAsync({
            staysActiveInBackground: true,
            //interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
            shouldDuckAndroid: false,
            playThroughEarpieceAndroid: false,
            allowsRecordingIOS: false,
            //interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
            playsInSilentModeIOS: true,
            
          });

InterruptionModes are commented out because of another error I was receiving:

Property 'INTERRUPTION_MODE_ANDROID_DO_NOT_MIX' does not exist on type 'typeof import("/Users/rjm/blip-dev/node_modules/expo-av/build/Audio")

does anyone know what might be causing this or how I can fix it?

1 Answers1

0

i have the same error and i solved it by put the object of the audio class out of the component function look here

and if your object in a constructor of class you can Put the object of this class out of the component function look here - and here don't use any hook in this constructor this may cause error