mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Update durations when playback rate changes. Fire timer to update UI
This commit is contained in:
parent
8c4c88a51a
commit
6c2333fd65
1 changed files with 9 additions and 1 deletions
|
|
@ -200,7 +200,9 @@ public class AudioController: NSObject, ObservableObject, AVAudioPlayerDelegate
|
|||
|
||||
@AppStorage(UserDefaultKey.textToSpeechPlaybackRate.rawValue) public var playbackRate = 1.0 {
|
||||
didSet {
|
||||
print("setting textToSpeechPlaybackRate: ", playbackRate)
|
||||
updateDurations(oldPlayback: oldValue, newPlayback: playbackRate)
|
||||
unpause()
|
||||
fireTimer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -223,6 +225,12 @@ public class AudioController: NSObject, ObservableObject, AVAudioPlayerDelegate
|
|||
return "en-US-EricNeural"
|
||||
}
|
||||
|
||||
private func updateDurations(oldPlayback: Double, newPlayback: Double) {
|
||||
if let oldDurations = durations {
|
||||
durations = oldDurations.map { $0 * oldPlayback / newPlayback }
|
||||
}
|
||||
}
|
||||
|
||||
public func isLoadingItem(item: LinkedItem) -> Bool {
|
||||
(state == .loading || player?.currentItem?.status == .unknown) && self.item == item
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue