From 3e4f9409df3937a0248aaf586175159a2bafe164 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 1 Dec 2022 12:50:57 +0800 Subject: [PATCH] Dont fully close audio player on error This gives users the ability to change the selected language if the error was related to language / voice. --- .../Sources/App/Views/AudioPlayer/ExpandedPlayer.swift | 4 ++++ .../Sources/Services/AudioSession/AudioController.swift | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedPlayer.swift b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedPlayer.swift index 61265e7ca..cd6271ef5 100644 --- a/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedPlayer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/AudioPlayer/ExpandedPlayer.swift @@ -346,6 +346,10 @@ if let itemAudioProperties = self.audioController.itemAudioProperties { playerContent(itemAudioProperties) .tint(.appGrayTextContrast) + .alert("There was an error playing back your audio.", + isPresented: $audioController.playbackError) { + Button("Dismiss", role: .none) {} + } } else { EmptyView() } diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift index e5a6e454c..065c01933 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift @@ -120,7 +120,7 @@ } public func stopWithError() { - stop() + pause() playbackError = true } @@ -667,7 +667,7 @@ @objc func fireTimer() { if let player = player { if player.error != nil || player.currentItem?.error != nil { - stop() + stopWithError() } if let durations = durations {