General fixes (#102)
* Improved PDF embedded annotation hit detection logic * Updated EPUB and PDF reader logic to improve position tracking and TTS stability. Key changes: - Refined CFI and locator handling in `EpubReaderScreen` with improved initialization. - Updated `BookPaginator` to more accurately calculate text offsets in chunks and improve CFI matching logic. - Modified `TtsPlaybackManager` to insert media items at the correct index, ensuring proper playback order. - Simplified `EpubReaderTts` page scrolling by removing conditional checks for backward jumps. - Disabled OCR fallback in `PdfViewerScreen` during text extraction for TTS. * Updated extractTextWithCfiFromTop to use getBoundingClientRect for identifying the starting block
This commit is contained in:
parent
ddcd253c7b
commit
fbe8e7aa56
9 changed files with 95 additions and 184 deletions
|
|
@ -473,7 +473,15 @@ class TtsPlaybackManager(
|
|||
}
|
||||
|
||||
if (!exists) {
|
||||
player.addMediaItem(nextMediaItem)
|
||||
var insertPosition = player.mediaItemCount
|
||||
for (k in 0 until player.mediaItemCount) {
|
||||
val id = player.getMediaItemAt(k).mediaId.toIntOrNull() ?: -1
|
||||
if (id > targetIndex) {
|
||||
insertPosition = k
|
||||
break
|
||||
}
|
||||
}
|
||||
player.addMediaItem(insertPosition, nextMediaItem)
|
||||
}
|
||||
|
||||
if (player.playbackState == Player.STATE_ENDED && player.playWhenReady && targetIndex == player.currentMediaItemIndex + 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue