Skip to content

Commit

Permalink
Fix TTS in a fixed-layout EPUB (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Aug 13, 2024
1 parent 7c08d29 commit 6ea996f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. Take a look
#### Navigator

* Fixed computing the total progression of audiobook locators.
* Fixed starting the TTS from the current resource in a fixed-layout EPUB.


## [3.0.0-beta.2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1008,12 +1008,19 @@ public class EpubNavigatorFragment internal constructor(
override suspend fun firstVisibleElementLocator(): Locator? {
if (!::resourcePager.isInitialized) return null

val resource = readingOrder[resourcePager.currentItem]
return currentReflowablePageFragment?.webView?.findFirstVisibleLocator()
?.copy(
href = resource.url(),
mediaType = resource.mediaType ?: MediaType.XHTML
)
return when (viewModel.layout) {
EpubLayout.FIXED ->
currentLocator.value

EpubLayout.REFLOWABLE -> {
val resource = readingOrder[resourcePager.currentItem]
currentReflowablePageFragment?.webView?.findFirstVisibleLocator()
?.copy(
href = resource.url(),
mediaType = resource.mediaType ?: MediaType.XHTML
)
}
}
}

/**
Expand Down

0 comments on commit 6ea996f

Please sign in to comment.