My sounds work fine on my simulator and using Expo on my phone, but for some reason, as soon as I deploy to Test Flight, I get no sound whatsover. I’m building using the standard expo build:ios
and letting Expo take care of everything - then uploading to the App Store. I thought it might be a path issue, but I’ve tried adding the WAVs in the same folder, and still no luck.
Here’s my code:
constructor(props) {
super(props);
this.heartBeat = new Audio.Sound();
}
async componentWillMount() {
await Audio.setAudioModeAsync({
playsInSilentModeIOS: true,
allowsRecordingIOS: false,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS,
shouldDuckAndroid: false,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
playThroughEarpieceAndroid: true
});
await Audio.setIsEnabledAsync(true);
await this.heartBeat.loadAsync(require("./MySound.wav"));
}
handlePlaySound = async () => {
try {
await this.heartBeat.setPositionAsync(0);
await this.heartBeat.playAsync();
} catch (error) {
console.log("ERROR", error);
}
};
Then call handlePlaySound
when I want it to play. Works fine locally, just not on production.
Here’s my app.json
{
"expo": {
"name": "My App",
"version": "0.0.4",
"slug": "my-app",
"sdkVersion": "32.0.0",
"ios": {
"bundleIdentifier": "com.myapp"
},
"android": {
"package": "com.myapp"
}
}
}
And my package.json dependencies list.
"dependencies": {
"babel-preset-expo": "^5.0.0",
"expo": "^32.0.0",
"react": "16.5.0",
"react-native": "0.57.1",
"react-native-stopwatch-timer": "0.0.20",
"react-navigation": "^1.5.7"
}
Would greatly appreciate any advice, as I’m running out of ideas!
Thanks for any help.