Swift-Radio-Pro icon indicating copy to clipboard operation
Swift-Radio-Pro copied to clipboard

Interruption Handling Notifications not working

Open Kedar-27 opened this issue 4 years ago • 2 comments

private func setupNotifications() {

let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector: #selector(handleInterruption), name: AVAudioSession.interruptionNotification, object: nil) notificationCenter.addObserver(self, selector: #selector(handleRouteChange), name: AVAudioSession.routeChangeNotification, object: nil) notificationCenter.addObserver(self, selector: #selector(playerDidFinishPlaying), name: .AVPlayerItemDidPlayToEndTime, object: nil)

    notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemNewErrorLogEntry, object: nil)

     notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemFailedToPlayToEndTime , object: nil)

    notificationCenter.addObserver(self, selector: #selector(playerDidRecieveError(_:)), name: .AVPlayerItemPlaybackStalled , object: nil)`

}

I added 3 more notifications for interruption handling, but seems not to be working please help with this issue @analogcode @fethica

Kedar-27 avatar Sep 20 '19 11:09 Kedar-27

@Kedar-27 Can you add more context on why you'd like to add the notifications? The interruptions are handled by default, and you can use the delegate interface of the RadioPlayer to add custom behaviour.

fethica avatar Oct 02 '19 15:10 fethica

@Kedar-27 Can you add more context on why you'd like to add the notifications? The interruptions are handled by default, and you can use the delegate interface of the RadioPlayer to add custom behavior.

Yes, we have delegates, but they all detect the error at the start of playback. I wanted more precise error handling during playback

Kedar-27 avatar Oct 03 '19 19:10 Kedar-27