Skip to content

handleAudioPlayerStateChange call multiple time #135

@ralspatel

Description

@ralspatel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions