expo av Audio failed to load, error: Error: java.lang.IllegalStateException: Content of this type is unsupported at the moment. Unsupported type: 4

Hi all!

I have a small sound clip to play again and again, and it suddenly does not work. I did upgraded to Expo 46, but even when I fall back to 45, the error still persists:

  1. load sound in a Context that wrap App.js
  const [sound, setSound] = React.useState();

// preload sound
  useEffect(() => {
    const loadSound = async () => {
      const { sound } = await Audio.Sound.createAsync(
        require("../../assets/sounds/countDownSound.mp3")
      );
      setSound(sound);
      console.log("Loading Sound in IAP: ", sound);
    };

    loadSound().catch((e) => console.log("Load sound error: ", e));
  }, []);

And in the file that need to execute:

useEffect(() => {
    const play = async () => {
      await sound.replayAsync();
      console.log("Play Sound");
    };

    if (seconds === 3) {
      play().catch((error) => console.error("error in Play", error));
    }
  }, [seconds]);

The error is: Error: java.lang.IllegalStateException: Content of this type is unsupported at the
moment. Unsupported type: 4

Did not find much information about this error. Any ideas what is wrong? Thanks a lot!

BTW, the same program can load and replay sounds without problems in iOS. And since the error message of Java, so it is an Android specific thing?

Hey all! I am still banging my head and have tried everything I can think of. The same code alone works in both Expo 45 and 46. Plus the face that the App runs and build well in iOS, so it is obviously not a problem of the library or the code. Maybe I cannot load sounds in Context? Tried move the loading and play together, still get the same error. Also tried to remove some of the plugin and library I installed. Maybe they crash in Android in some weird way? No, cannot identify the problems too…

I cannot even find what “Unsupported type: 4” means. I tried to use “”, 0, {} as initial state of sound, still error.

I am out of ideas. Any directions / suggestion will be very appreciated! Many thanks!

Have you found a solution for this? I’ve run into this problem which seems to be unique to our combination of packages. If I test an mp3 file in a barebones snack it works perfectly fine (The same one that reports the Unsupported type: 4 error).

Expo: 46
RN: 0.69.6
expo-av: 12.0.4