In my app I have a feature that plays a sound when a message is received it will notify the user by playing a sound file, the app works using react-native-sound fine in Android but in iOS I keep getting this error:
Code I am using for initializing the sound:
import Sound from "react-native-sound"
// Load the sound file 'whoosh.mp3' from the app bundle
// See notes below about preloading sounds within initialization code below.
var message_received = new Sound(require("../../res/audio/Page_Turn.mp3"), Sound.MAIN_BUNDLE, (error) => {
if (error) {
console.log('failed to load the sound', error);
return;
}
// loaded successfully
console.log('duration in seconds: ' + message_received.getDuration() + 'number of channels: ' + message_received.getNumberOfChannels());
});
The method that I call after initializing sound file:
message_received.play()
Does anyone know how to solve this?