mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Use currentAudioIndex, this will give us the option to force it to a differnt value
Sometimes the play item isn't updated very quickly, the timeElapsed can be greater than the duration in those cases. We could probably force the currentItemIndex to increment in those cases to get speech cards to update.
This commit is contained in:
parent
a0f17185d8
commit
59271882a5
1 changed files with 2 additions and 1 deletions
|
|
@ -377,7 +377,7 @@
|
|||
// Sometimes we get negatives
|
||||
currentItemOffset = max(currentItemOffset, 0)
|
||||
|
||||
let idx = item.speechItem.audioIdx
|
||||
let idx = currentAudioIndex // item.speechItem.audioIdx
|
||||
let currentItem = document?.utterances[idx].text ?? ""
|
||||
let currentReadIndex = currentItem.index(currentItem.startIndex, offsetBy: min(currentItemOffset, currentItem.count))
|
||||
let lastItem = String(currentItem[..<currentReadIndex])
|
||||
|
|
@ -561,6 +561,7 @@
|
|||
if let player = player {
|
||||
observer = player.observe(\.currentItem, options: [.new]) { _, _ in
|
||||
self.currentAudioIndex = (player.currentItem as? SpeechPlayerItem)?.speechItem.audioIdx ?? 0
|
||||
self.updateReadText()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue