I use AVPlayer to stream tracks.I'm trying to handle all errors like network unavailable or stream unaivalable But I find any handler for this kind of error.
I've already added a KVO for on the avplayer's status.
[self.player addObserver:self forKeyPath:@"status" options:0 context:nil];
But even the stream doesn't exist (example: wrong url), the status switch to AVPlayerStatusReadyToPlay.
EDIT
Solution was to work with AVPLayerItems and use AVQueuPlayer. The other problem was I reallocated this player at every tracks.
Add KVO to AVPlayerItem instead of AVPlayer with NSKeyValueObservingOptionNew as well.
[playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:NULL];
[self.player replaceCurrentItemWithPlayerItem:playerItem];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With