mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-29 06:18:51 +02:00
Update:iOS do not resume playback after app suspended. Attempted fix for #973
This commit is contained in:
parent
0da6fca727
commit
826d414d9f
1 changed files with 17 additions and 7 deletions
|
@ -534,6 +534,16 @@ class AudioPlayer: NSObject {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When interruption is from the app suspending then don't resume playback
|
||||||
|
if #available(iOS 14.5, *) {
|
||||||
|
let reasonValue = userInfo[AVAudioSessionInterruptionReasonKey] as? UInt ?? 0
|
||||||
|
let reason = AVAudioSession.InterruptionReason(rawValue: reasonValue)
|
||||||
|
if (reason == .appWasSuspended) {
|
||||||
|
logger.log("AVAudioSession was suspended")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch type {
|
switch type {
|
||||||
case .ended:
|
case .ended:
|
||||||
guard let optionsValue = userInfo[AVAudioSessionInterruptionOptionKey] as? UInt else { return }
|
guard let optionsValue = userInfo[AVAudioSessionInterruptionOptionKey] as? UInt else { return }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue