audio-player
audio-player copied to clipboard
Sort order of Tracks
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?
ey, sorry to bother u maybe u know how to add internal audios like if it was with src
@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
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
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
Thanks for the valuable suggestion @jdaly13 ! This could be useful, now deployed!