SwiftAudio
SwiftAudio copied to clipboard
handleAudioPlayerStateChange call multiple time
Hi @jorgenhenrichsen
func handleAudioPlayerStateChange(data: AudioPlayer.StateChangeEventData) { }
with QueuedAudioPlayer when it plays the song at that time above method call 1 time, once all queued song playing finished, I go back and stop the player so upcoming and previous item will be erased. once I come back at that time above method call 2 times, when I come back at that time above method call 3 times, and so on.
I call the below method in viewwillappear method
controller.player.event.stateChange.addListener(self, handleAudioPlayerStateChange) controller.player.event.secondElapse.addListener(self, handleAudioPlayerSecondElapsed) controller.player.event.seek.addListener(self, handleAudioPlayerDidSeek) controller.player.event.updateDuration.addListener(self, handleAudioPlayerUpdateDuration) controller.player.event.didRecreateAVPlayer.addListener(self, handleAVPlayerRecreated)
controller.player.event.playbackEnd.addListener(self, handlePlayEnd) controller.player.event.fail.addListener(self, handlePlayerFailure) controller.player.nowPlayingInfoController.set(keyValue: NowPlayingInfoProperty.isLiveStream(true))
so I need to remove this listener? if yes then when I need to remove this listner.
Thanks
Hi @ralspatel Did you find any solution for this? I tried removing listener as well but it keeps calling in other screens as well even thogh I have removed listener for that screen. Thanks