Hi!
On iOS works perfectly. But when I call "new Sound" on Android, app freezes and nothing logging to console. Has anyone had this problem?
var whoosh = new Sound('whoosh.mp3', Sound.MAIN_BUNDLE, (error) => {
if (error) {
console.log('failed to load the sound', error);
} else {
console.log('loaded successfully ')
}
});
I check it in empty project and run on android device and I have this problem too. When I call new Sound my app freezes.
Sorry. I don't know why, but this problem with my device (xiaomi redmi 4a). I reboot it and library became works well.
@oxilor same issue in my xioami redmi 4a. any solution?
@adirzoari I just reboot my device and everything was okay. Try it.
@oxilor I reboot my device and still it freeze. weird.
if I delete the sound, everything works good.
@adirzoari What about another apps? Are they playing audio without freeze?
yes. I have many apps with sound and everything works good
@adirzoari try download app Lingain, add new word in "My vocabulary" tab and click to speaker. Is app freeze?
no. your app is not freeze. when i add new word I hear it and it works good.
thanks I will try. in your example, you used react-native-fs. for what?
i did this way (in debug mode it sometimes works and I hear the sound, in the release it freeze)
import Sound from 'react-native-sound'
export const playSound = (sound) => {
const music = new Sound(sound, Sound.MAIN_BUNDLE, (error) => {
if (error) {
console.log('failed to load the sound', error);
return;
}
// music.setVolume(0.8)
// loaded successfully, play
music.play((success) => {
console.log(success)
if (success) {
console.log('successfully finished playing');
music.release();
} else {
console.log('playback failed due to audio decoding errors');
}
});
});
}
Most helpful comment
Sorry. I don't know why, but this problem with my device (xiaomi redmi 4a). I reboot it and library became works well.