Is there any way to reproduce a sound that is on http without using native Android/IOS
components?
I found this module react-native-sound
, but it uses native parts and I wanted to know if there is a way to avoid being able to use them.
Is there any way to reproduce a sound that is on http without using native Android/IOS
components?
I found this module react-native-sound
, but it uses native parts and I wanted to know if there is a way to avoid being able to use them.
If you are using expo
then it has support for audio, you can see in the documentation here:
https://docs.expo.io/versions/v32.0.0/sdk/audio
However if you are not using expo
, and made your app with react-native init
then you will need to use a dependency that has native modules or write your own native module as processing audio on the javascript thread will block your app and make it unusable.
if you are using expo you can do something like that
const soundObject = new Expo.Audio.Sound();
playSound = async () => {
await soundObject.loadAsync({uri:'the uri of your audio'});
soundObject.playAsync();
}
now it should start playing your mp3 , for further details find expo documentation here https://docs.expo.io/versions/latest/sdk/audio