audio-player icon indicating copy to clipboard operation
audio-player copied to clipboard

Sort order of Tracks

Open jdaly13 opened this issue 1 year ago • 4 comments

Hello Thank you for your player it is very helpful, I noticed in your code base you are automatically sorting track title alphabetically but if you want to sort the array yourself and control the order of the playlist, currently you are unable to do so

const Player = ({ trackList, includeTags = true, includeSearch = true, showPlaylist = true, autoPlayNextTrack = true, customColorScheme = colors, sortTracks = true, })

if you add sortTracks as a config and a user could pass in False

Then on line 203 of index.js

you can add const sortCompare = (a, b) => { if (!sortTracks) return null return a.title > b.title ? 1 : -1; }

and on line 311 you can just use that fun .sort(sortCompare)

If I put in a PR would you approve?

jdaly13 avatar Sep 27 '23 20:09 jdaly13

ey, sorry to bother u maybe u know how to add internal audios like if it was with src

jagg0409 avatar Nov 02 '23 19:11 jagg0409

@jagg0409 - I would think they would support relative urls if not - whatever origin you're using from you would need to do the full (absolute) url - like localhost:3000/static/mymp3track.mp3

jdaly13 avatar Nov 08 '23 19:11 jdaly13

hey @jdaly13 thanks for the answer, i hv try both but its not working idk if u can help me with that im really trying to learn and this is one of my proyects in case u hv some time to take a look u can check the proyect and more specific the error right here https://github.com/jagg0409/arcticfy-react/blob/master/src/components/albums-inside/AlbumsInside.js thanks a lot for the answer

jagg0409 avatar Nov 08 '23 22:11 jagg0409

I would love to help with basic web dev skills but your paths are backwards slashes and also you need to read up on how to access local media within your create react app - https://create-react-app.dev/docs/adding-images-fonts-and-files/ This is not the right forum for this as this thread is originally used for a bug in the original source code of the package you can message me on github and I can try to help you out but again this comment thread is not the appropriate place

jdaly13 avatar Nov 09 '23 04:11 jdaly13

Thanks for the valuable suggestion @jdaly13 ! This could be useful, now deployed!

madzadev avatar Feb 05 '24 01:02 madzadev