Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handleAudioPlayerStateChange call multiple time #135

Open
ralspatel opened this issue Apr 20, 2021 · 1 comment
Open

handleAudioPlayerStateChange call multiple time #135

ralspatel opened this issue Apr 20, 2021 · 1 comment

Comments

@ralspatel
Copy link

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

@moonakash
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants