react native local audio files play without any package
- User
react native local audio files play without any package
- Assistant
- User
without expo
- Assistant
- User
what if i want to play files from music folder
- Assistant
- User
make it scan the storage automatically for the audio files
- Assistant
- User
here scan entire perimitive storage for audio files
const scanAudioFiles = async () => { try { const musicFolderPath =
${RNFS.ExternalStorageDirectoryPath}/Music;const files = await RNFS.readDir(musicFolderPath); // Scan the directory // Filter only audio files (add more extensions if needed) const audioFiles = files.filter(file => file.name.endsWith('.mp3') || file.name.endsWith('.wav')); setAudioFiles(audioFiles); } catch (err) { console.error('Error reading files: ', err); }};
- Assistant
- User
Parameter 'dirPath' implicitly has an 'any' type.ts(7006) (parameter) dirPath: any
- Assistant
- User
do not scan files inside android filder
- Assistant
- User
only search if the parent folder name is start with music, inside that music folder may contain other folders without name as 'music'
- Assistant
- User
- Assistant
- User
i got the log as Playing sound from path: /storage/emulated/0/Download/1DMP/Music/022ddc05-b8b5-4dc3-b0aa-7dfb1b8c3ddb.mp3 but there is no sound. my device volume is full
- Assistant
- User
Property 'setOnPlaybackFinish' does not exist on type 'Sound'.
- Assistant
- User
this are the logs
Running "musicplayer" with {"rootTag":71,"initialProps":{},"fabric":true} 2AudioPlayer.tsx:63 Error reading files: Error: Attempt to get length of null array anonymous @ console.js:614 reactConsoleErrorHandler @ ExceptionsManager.js:182 overrideMethod @ backend.js:17785 anonymous @ setUpDeveloperTools.js:62 registerError @ LogBox.js:211 anonymous @ LogBox.js:79 ?anon_0_ @ AudioPlayer.tsx:63 asyncGeneratorStep @ asyncToGenerator.js:3 _throw @ asyncToGenerator.js:20 Show 8 more frames Show less AudioPlayer.tsx:49 Found audio file: /storage/emulated/0/Download/1DMP/Music/022ddc05-b8b5-4dc3-b0aa-7dfb1b8c3ddb.mp3 AudioPlayer.tsx:68 Playing sound from path: /storage/emulated/0/Download/1DMP/Music/022ddc05-b8b5-4dc3-b0aa-7dfb1b8c3ddb.mp3
its not getting inside Sound loaded successfully
- Assistant
- User
there are two AndroidManifest.xml files, in main and in debug, where should i add the permission
- Assistant
- User
- Assistant