cinder92 / react-native-get-music-files

React Native package to get music files from local and sd for iOS and Android
MIT License
130 stars 66 forks source link

Covers are null on React Native 0.63.2 #78

Closed farshed closed 11 months ago

farshed commented 4 years ago

I'm using RNAndroidAudioStore. It was working perfectly with 0.62.1. I just created a fresh project with 0.63.2 and transferred all the source code and now covers are null.

RNAndroidAudioStore.getAll({
         title: true,
    artist: true,
    album: true,
    duration: true,
    cover: true,
    blured: false,
        coverFolder
});
Drazail commented 4 years ago

@farshed

react-native 0.63 introduced some breaking changes and bugs, Im working on porting the project to 0.63 asap.

kaneki666 commented 3 years ago

any update on it?

Drazail commented 3 years ago

@kaneki666 @farshed

You can use v3-dev-patch1 of my fork, it should be resolved there.

kaneki666 commented 3 years ago

Working like a charm! thank you bro @Drazail

kaneki666 commented 3 years ago

brother i am having a prb when i use the cover folder it doesn't save the extension of image so i cant read it,, function getAll() { MusicFiles.getAll({ cover: true, coverFolder: '/storage/emulated/0/Download/', batchSize: 0, batchNumber: 0, sortBy: Constants.SortBy.Title, sortOrder: Constants.SortOrder.Ascending, }) .then((f) => { setData(f.results); }) .catch((er) => console.log(e)); }

but when i use your Coverimage which gets image by path it works but i cant style it border radius doesnt work and it doesn't get image when i copy a full album..image blank and but image works in stock music app

Drazail commented 3 years ago

@kaneki666

I don't think inclusion of an extension is required to display an image ( or opening any file for that matter). can you post the error log you get when passing the path provided by getAll to the Image component?

coverImage component, it is meant to extract the embedded artwork directly from a media file into a byte[] inside the ram and display it, the source prop should point to a media file. ( a point of caution: if you are going to use this component inside a flatlist, be sure to optimize you list as by default flatlist loads the first 100 elements of data all at once, this can lead to performance issues.)

about styling, it should work exactly as react native's Image component, all methods and props are implemented. however, if you are facing any problems ( as is common with Image component itself ), you can always wrap it in a view and pass your styles to that view instead, ie:

 <View
    style={{        
      borderRadius: 10, 
      alignItems: 'center', 
      justifyContent: 'center',
      overflow: 'hidden',
      width: 120,   
      height: 120,  
      padding: 10,  
    }}> 
    <CoverImage 
      source={  
        '/storage/emulated/0/Download/03 - Nocturne No 2 in E flat major.mp3'   
      }
      width={120}   
      height={120}  
      resizeMode="contain"  
    />  
  </View>
cinder92 commented 11 months ago

closing this in favor of https://github.com/cinder92/react-native-get-music-files/pull/108