react-native-fs icon indicating copy to clipboard operation
react-native-fs copied to clipboard

How can i scan for audio files/songs stored on local storage of iOS devices?

Open themakerman opened this issue 8 years ago • 19 comments

I am making a music player using React Native. Can someone please show me some direction on how i can load songs/audio files stored locally on clients device in JSON format and show them as a list? I found react-native-get-music-files npm library that serves the purpose but it only supports Android. Thanks.

themakerman avatar Aug 02 '17 09:08 themakerman

try this https://github.com/futurice/react-native-audio-toolkit/blob/master/docs/SOURCES.md

eslambasher avatar Aug 09 '17 15:08 eslambasher

I use react-native-sound to play files that was downloaded once before with RNFS.

itinance avatar Aug 09 '17 16:08 itinance

@itinance did you accessed the files stored locally on iOS device?

themakerman avatar Aug 11 '17 11:08 themakerman

@eslambasher playback of local files is only supported on Android. I need solutions for iOS. Can u give me some pointers?

themakerman avatar Aug 18 '17 13:08 themakerman

@themakerman

@itinance did you accessed the files stored locally on iOS device?

Yes, sure. On Android the prefix "file://" is required sometimes while on iOS not.

itinance avatar Aug 18 '17 14:08 itinance

@eslambasher have you tried "react-native-sound". I have 4 apps with this both for iOS and android that plays local audio files that was downloaded with RNFS. The same for video with react-native-video.

itinance avatar Aug 18 '17 14:08 itinance

@eslambasher where have you stored the files? Document-Directory? Caches-Directory? You should show at least some code that people can get an idea of what you are talking about in detail

itinance avatar Aug 18 '17 14:08 itinance

actually,I used it just to test the module but for the recordings files I have to use expo audio for recording and play file (https://docs.expo.io/versions/latest/sdk/audio.html) because my application was created with expo so I could not use the module that I should link, about expo recording i store my audio file in Caches-Directory and then i send it in my database for play it from my site.

eslambasher avatar Aug 18 '17 14:08 eslambasher

@itinance so see i sync the files on my iOS device by connecting it to itunes. I am very new to iOS environment and have no knowledge of objective-c/swift/iOS file system. I just want someway to dump list of audio files synced with itunes [list must contain album art/path to file/title...etc] so i can render it using listView. Can anyone tell me how can i achieve this? I was thinking of rooting my iOS device to better understand where do music files go in future but if react-native-fs can help me achieve it without that it will be great.

themakerman avatar Aug 18 '17 17:08 themakerman

ok i am using react-native-get-music-files@v2. v2 supports both iOS and android.

themakerman avatar Dec 11 '17 10:12 themakerman

@themakerman, have you got path of music on iOS?

ithustle avatar Jun 03 '18 20:06 ithustle

@ithustle yes. using react-native-get-music-files library.

themakerman avatar Jun 04 '18 07:06 themakerman

@themakerman, can you show me an example? For me, only works on Android...

ithustle avatar Jun 04 '18 07:06 ithustle

@ithustle Hi did you includedNSUsage permissions in your info.plist? I think you have to add key value for this corresponding permission ---> NSAppleMusicUsageDescription

themakerman avatar Jun 05 '18 03:06 themakerman

Hi @themakerman. Yes, I did. It just give to me the music title, artists but not file path...

ithustle avatar Jun 05 '18 07:06 ithustle

@ithustle okay let me check my code. But will take some time as i am running little busy.

themakerman avatar Jun 05 '18 13:06 themakerman

@themakerman, its okay. I'll waiting...

ithustle avatar Jun 05 '18 13:06 ithustle

@ithustle @themakerman @eslambasher @itinance Any update for iOS because I am getting audio files from the android devices but not for iOS. Let me know if I am doing anything wrong.

Getting issue with homepage so that is done s.homepage = "https://github.com/cinder92/react-native-get-music-files"

Here is my code. MusicFiles.getAll({ id: true, blured: false, artist: true, duration: true, //default : true cover: true, //default : true, title: true, cover: true, batchNumber: 5, //get 5 songs per batch minimumSongDuration: 10000, //in miliseconds, fields: [ 'title', 'artwork', 'duration', 'artist', 'genre', 'lyrics', 'albumTitle' ] }) .then((tracks) => { console.log('MusicFiles tracks ::::', tracks); }) .catch((error) => { console.log('MusicFiles error ::::', error); }); info.plist kTCCServiceMediaLibrary Text NSAppleMusicUsageDescription Text

Now i am getting this error: TypeError: null is not an object (evaluating 'RNReactNativeGetMusicFiles.getAll')

codal-mpawar avatar Nov 19 '21 06:11 codal-mpawar

same issue...

sanketk478 avatar Jan 08 '22 12:01 sanketk478