Reputation: 4175
I'm playing sound using react-native-sound
and is playing on iOS 12 device but when I check in iOS 13 device is not playing.
here is my code
this.soundPlayer = new Sound(require('../assets/fly.mp3'), '', (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})
Upvotes: 0
Views: 2421
Reputation: 161
const notificationSound = new Sound('ring_tone.wav', Sound.MAIN_BUNDLE, (error) => {
if (error) {
console.log('failed to load the sound', error);
return;
}
});
enter code here
Please use following way in ios notificationSound.play(() => {});
Android notificationSound.play();
Upvotes: 0
Reputation: 4175
if you load sound using require
then use
this.soundPlayer = new Sound(require('../assets/fly.mp3'), (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})
and when you load sound in the network then use
this.soundPlayer = new Sound(require('../assets/fly.mp3'), '', (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})
Upvotes: 3