Thanks so much for the React Native Sound package.
I have tested the package with remote files and required ones using require module. But my problem is playing a file that is not in the two categories above.
For example, I use react-native-document-picker which allows the user to select a file from the phone storage. I want to play that sound but I am not able.
Please what is the suggested way of dealing with sort like that?
let callback = (error, sound) => {
if (error) {
console.log('failed to load the sound', error);
return;
}
sound.play(() => {
sound.release();
});
}
let soundFile = this.props.uri
soundFile = require("../assets/audio/advertising.mp3") //working fine
var sound = new Sound(soundFile, error => callback(error, sound));
soundFile = "https://raw.githubusercontent.com/zmxv/react-native-sound-demo/master/frog.wav" //this working.
var sound = new Sound(soundFile, "", error => callback(error, sound));
soundFile=this.props.uri //not working. The uri is the location of the file selected by the user. Sample uri looks like "file://content://com.android.externalstorage.documents/document/300C-0FED%3AMusics%2FJWLibrary%2Fiacu_E_03.mp3"
var sound = new Sound(soundFile, "", error => callback(error, sound));
Thanks so much for the React Native Sound package.
I have tested the package with remote files and required ones using require module. But my problem is playing a file that is not in the two categories above.
For example, I use react-native-document-picker which allows the user to select a file from the phone storage. I want to play that sound but I am not able.
Please what is the suggested way of dealing with sort like that?
Thank you for your prompt response