SwiftAudio icon indicating copy to clipboard operation
SwiftAudio copied to clipboard

How to know that the song is ended

Open nishant6042 opened this issue 5 years ago • 1 comments

In my app i am playing single song so no option for next and previous. I want that when the songs end then the slider value should be reset, the play btn image should be changed and the current time should be "00:00" so that i can again play. But right now as per your example when the songs end the play button image changes to play, the song stops but the slider and current time label doesnt change and if i press play button then nothing happens

nishant6042 avatar Aug 20 '20 08:08 nishant6042

@nishant6042 implement this event on player player.event.playbackEnd.addListener(self, handlePlaybackEnd)

    func handlePlaybackEnd(data: AudioPlayer.PlaybackEndEventData) {
        if data == .playedUntilEnd {
            //playing ended
        }
    }

kodekarim avatar Sep 30 '20 09:09 kodekarim