madzadev / audio-player

🎵 Music player with custom controls, playlist, filters, and search.
https://audioplayer.madza.dev
362 stars 50 forks source link

How to add a song store in the project #12

Closed jagg0409 closed 8 months ago

jagg0409 commented 11 months ago

Is this possible?

madzadev commented 8 months ago

Sure it is possible unless you provide a valid audio source to the stored files.

Create a separate folder of tracks locally in your project and then provide the path to it. For example, if you are using React and create a music folder inside the public directory, the path would look:

const tracks = [
  {
    url: "music/yourtrack.mp3",
    title: "artist-title",
    tags: ["genre"],
  }
]

Alternatively, you can pass them from external sources, like in the .readme example of this project: You can use CMS or other sites that allow hosting audio files and access their URLs, like so:

const tracks = [
  {
    url: "https://youraudiowebsite.com/yourtrack.mp3",
    title: "artist-title",
    tags: ["genre"],
  }
]

Hopefully helpful, best of luck!