1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 13:50:32 +05:30

fix tvOS build

Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
Toni Förster 2024-09-13 11:48:40 +02:00
parent a65ed67751
commit 4855f9bead
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

@ -1322,26 +1322,29 @@ final class PlayerModel: ObservableObject {
logger.info("Interruption type received: \(type)") logger.info("Interruption type received: \(type)")
// Check availability for iOS 14.5 or newer to handle interruption reason // Check availability for iOS 14.5 or newer to handle interruption reason
if #available(iOS 14.5, *) { // Currently only for debugging purpose
// Extract the interruption reason, if available #if os(iOS)
if let reasonValue = info[AVAudioSessionInterruptionReasonKey] as? UInt, if #available(iOS 14.5, *) {
let reason = AVAudioSession.InterruptionReason(rawValue: reasonValue) // Extract the interruption reason, if available
{ if let reasonValue = info[AVAudioSessionInterruptionReasonKey] as? UInt,
logger.info("Interruption reason received: \(reason)") let reason = AVAudioSession.InterruptionReason(rawValue: reasonValue)
switch reason { {
case .default: logger.info("Interruption reason received: \(reason)")
logger.info("Interruption reason: Default or unspecified interruption occurred.") switch reason {
case .appWasSuspended: case .default:
logger.info("Interruption reason: The app was suspended during the interruption.") logger.info("Interruption reason: Default or unspecified interruption occurred.")
@unknown default: case .appWasSuspended:
logger.info("Unknown interruption reason received.") logger.info("Interruption reason: The app was suspended during the interruption.")
@unknown default:
logger.info("Unknown interruption reason received.")
}
} else {
logger.info("AVAudioSessionInterruptionReasonKey is missing or not a UInt in userInfo.")
} }
} else { } else {
logger.info("AVAudioSessionInterruptionReasonKey is missing or not a UInt in userInfo.") logger.info("Interruption reason handling is not available on this iOS version.")
} }
} else { #endif
logger.info("Interruption reason handling is not available on this iOS version.")
}
// Handle the specific interruption type // Handle the specific interruption type
switch type { switch type {