benwiley4000 / cassette

📼 A flexible media player component library for React that requires no up-front config
https://benwiley4000.github.io/cassette/styleguide
MIT License
185 stars 28 forks source link

onBeforeTrackChange Provider property #513

Open tyv opened 1 year ago

tyv commented 1 year ago

hey, this is regarding and closes #512 (took me a while to make it run)

I propose property onBeforeTrackChange to provider, which gets same args as goToTrack and should return same or new data with the same structure.

benwiley4000 commented 1 year ago

Thanks for proposing some code. For now I'm not sure if I would be ready to merge it because the use case seems very niche. All other event handlers are after changes to playback state or for error handling. It's difficult to imagine what the broad use case would be for intercepting a request to go to the next track, since you already have control over the playlist contents and order. Could you explain why you need to skip some tracks, but you still allow the user to access them?