I have a React Native application in which I am trying to play different sounds with different extesions like .mp3, .wav, .midi
. My issue is that I can't access the midi file
that is stored locally in assets folder
.
I tried by importing directly like
import midiFile from './assets/1.midi';
or through a index.js
file in assets folder
:
import midiFile from './1.mid';
const Assets = {
midiFile,
};
export default Assets;
And also tried to open with react-native-fs
like const midiFile = await RNFS.readFile('../assets/1.midi');
but with every method I will get that the 1.midi file does not exist
and I double, triple check everytime that the path is correct (created a totally new project with just App.tsx and assets folder
)
How can I use my local .midi file
? Is there any change needed in metro.config.js
or other file?
My scope is to play the sound through the react-native-sound
which works with .mp3 files
but I also need to make it work with .midi files
.
Thank you