mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Update read position while listening to audio
This commit is contained in:
parent
f047775532
commit
25055598e3
2 changed files with 11 additions and 1 deletions
|
|
@ -804,6 +804,17 @@ public class AudioController: NSObject, ObservableObject, AVAudioPlayerDelegate
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if timeElapsed - 10 > lastReadUpdate {
|
||||
let percentProgress = timeElapsed / duration
|
||||
let anchorIndex = Int((player?.currentItem as? SpeechPlayerItem)?.speechItem.htmlIdx ?? "") ?? 0
|
||||
|
||||
if let itemID = itemAudioProperties?.itemID {
|
||||
dataService.updateLinkReadingProgress(itemID: itemID, readingProgress: percentProgress, anchorIndex: anchorIndex)
|
||||
}
|
||||
|
||||
lastReadUpdate = timeElapsed
|
||||
}
|
||||
}
|
||||
|
||||
func clearNowPlayingInfo() {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ export function Article(props: ArticleProps): JSX.Element {
|
|||
const debouncedSetReadingProgress = useMemo(
|
||||
() =>
|
||||
debounce((readingProgress: number) => {
|
||||
console.log('setReadingProgress', readingProgress)
|
||||
setReadingProgress(readingProgress)
|
||||
}, 2000),
|
||||
[]
|
||||
|
|
|
|||
Loading…
Reference in a new issue