Obtaining music information such as (title, album name, artist name, etc.) in React Native

130 Views Asked by At

I am making a music player in React Native using the React-Native-Track-Player library that plays music from the phone's internal storage, so far everything is going well, but when I want music information such as album name, I'm having trouble getting the subtitle, artist name, etc., because there is no function for this in the React-Native-Track-Player library!

In React Native, is there a library to get music information like (like album name, subtitle, artist name, etc.)? (The library is react-native-get-music-files and react-native-music-metadata, but these libraries are old and do not work with the new version of React Native!)

Thanks

1

There are 1 best solutions below

0
Edouard On

If the music you are listening is coming from a radio flow, you can use this in the file where you define your service.

 TrackPlayer.addEventListener("playback-  metadata-received", (metadata) => {
console.log(metadata);
});

Otherwise, if you are using a series of songs you can use :

const podcasts = [
{
  title: "myTile",
  artist: "myArtist",
  artwork:
   "url of artwork",
  url: "url of the podcast",
}
];

export default podcasts;

Good Luck