zen-audio-player/zen-audio-player.github.io

Trivial suggestion: add a checkbox to apply auto replay / loop

andy-shi88 opened this issue · 2 comments

It's really a trivial feature I think some of us would like to have.

  • Able to control wether to stop a song or just auto replay [infinite loop] the song by one simple checkbox when the song ended.
    by the way, the app is really interesting.
    Let me know what you think

Thanks for the suggestion @andy-shi88! If you want to submit a PR I'm happy to review it.

In the timeupdate event listener (around line 218 in js/everything.js) we'd just need to compare plyrPlayer.plyr.embed.getCurrentTime() with plyrPlayer.plyr.embed.getDuration(). When the current time is the duration, we can set the current time to 0 with plyrPlayer.plyr.embed.seekTo(0).

@shakeelmohamed ok, I'll start working on it 😄