This is my first time using the Expo SDK Audio, so I’m clueless about what I’m doing wrong. Because it’s copied from the documentation, I guess the problem is the onPress = () => part, but I don’t know how to fix it. I googled, searched in the forums and in GitHub, but didn’t find any examples of how to implement a button that plays a local file or people making this same mistake. Here’s the code:
I’m sorry that I cannot be more specific about this, I have really no clue
why this is happening. There aren’t any errors, it’s just that the sound
isn’t played.
Hey Santiago you can take a look at this snack for reference https://snack.expo.io/BkBHa2cMM works on phone but not the simulator in the snack.
Few notes my snack shows a lot of errors
IOS in snack simulator loads but android doesn’t and some how expo app works on iphone.
ignore the .setRateAsync(3, false); that makes a audio like effect on the original sound i have.
let me know if this helps
Well, it works on the IOS simulator, but not on Android Simulator or my
phone (Android too). The error it logs is “Failed to install module
'./src/components/common”. I tried importing the Button from react-native,
but then it just changes to “Failed to install module './sounds/1.wav”. I
tried changing the path of the file, its name, the file itself, but it just
keeps doing the same. This error never showed up in my original code. Do
you know what could be going on?
I tried to implement it using the function and also directly with the
onPress, tested in both my phone and the Simulator, but the problem keeps
being the same: without showing any errors, the audio file does not play