AudioPlayer icon indicating copy to clipboard operation
AudioPlayer copied to clipboard

Not auto retry when connection lost

Open lopify opened this issue 8 years ago • 5 comments

I do as following:

let item = AudioItem(mediumQualitySoundURL: radioStation.streamURL) player.playItem(item)

Then I turn off the wifi, the music stops, I put the wifi back on and nothing happens... any idea of what I'm doing wrong?

Thanks!

lopify avatar Dec 18 '16 15:12 lopify

@lopify have you found how to solve this or another lib that solves? thx

sirvon avatar May 11 '17 19:05 sirvon

No @sirvon :-(

lopify avatar May 11 '17 20:05 lopify

I know why this happens.

In the code here: https://github.com/delannoyk/AudioPlayer/blob/master/AudioPlayer/AudioPlayer/player/AudioPlayer.swift#L88-L102

AVPlayer is set to nil which stops all event producers.

Then a .waitingForConnection state is reached and the function returns. But the NetworkEventProducer was never started again, so we will not receive any callbacks when the internet connection returns again.

I have a quickfix for this, that I could PR upstream, but I think we'll need to confer with @delannoyk on why the eventProducers are stopped and started in this manner first.

PS. Included Reachability could also use an update, as it often fails when stopped and started a lot like in AudioPlayer, at least in my tests. The newest version works better for me.

ddfreiling avatar May 16 '17 07:05 ddfreiling

any update @delannoyk

dimohamdy avatar Jun 21 '18 21:06 dimohamdy

any update?

zsaraf avatar Nov 07 '19 15:11 zsaraf