From 59271882a5ba0cbeae09ae56dff9980ef9b0da1c Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Thu, 10 Nov 2022 17:40:02 +0800 Subject: [PATCH] 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. --- .../Sources/Services/AudioSession/AudioController.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift index 9190160d5..58fff4248 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioController.swift @@ -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[..