EKIRJASTO-242 fix current audiobook player #192
+193
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's this do?
This pr attempts to fix the sleep timer and empty space at the end of the audiobook chapters when on greater player speeds. Also attempts to fix bookmarks going to incorrect spots when in faster speeds.
The buttons also get translated texts, that were previously only in English.
When it comes to the sleep timer, when set to end of chapter, the timer wouldn't work. This was because the audiobook would jump to the next chapter at the same time as the pause request came, so the pause got overwritten. This is now fixed by a boolean check, so if the sleep timer is on and we start a new chapter, we pause at the beginning of it.
Also fixed timer start for the cases we want to not start the sleep timer. It used to always start the end chapter timer that did not work, but now it can also not start a player.
For the empty space at the end of chapter, the problem was that the player doesn't recognize the player speed is faster, and thus the normal length of the chapter is too long. This is now patched up by some computations that tries to keep in time with the shortened file, and keeps the visible seekbar at correct time, and using the seek bar to know when we should manually skip to the next chapter. Same technique that is used to keep the time, is used to have the bookmarks be at correct spots.
NOTE: This doesn't fix the audio book skipping to the next chapter too early when playing in 0.75x speed, as this is still done by the player itself.
Why are we doing this? (w/ JIRA link if applicable)
This is done as a temporary solution to the most annoying audioplayer bugs that present themselves to most users. Most of these will have to be reversed when we update the audioplayer module, at some point. But until then, this is done to better the user experience.
[EKIRJASTO-242] https://jira.it.helsinki.fi/browse/EKIRJASTO-242
How should this be tested? / Do these changes have associated tests?
When testing, check all buttons and their actions.
Changing speed should make the numbers running on the player run faster.
The seekbar should present accurately where we are in the audio book, and manually jumping to a particular spot should be accurate.
On higher speeds, putting a bookmark to a spot, after letting the player run for a little while, is accurate, and the jump goes to accurate spot.
"End of file" sleep timer should pause at the beginning of next chapter on all speeds.
There should be no empty space at the end of chapters.
Check that when jumping to next chapter, the player doesn't accidentally jump over a chapter (was problem at some point in the code).
At the end of a book, the player should pause.
NOTE: Opening books might require you to change readium:liblcp version from 2.1.0 -> 4.1.0 in build.gradle.kts (simplified-app-ekirjasto), as these changes are done in an older branch. Also check that in build_libraries.toml kotlin-toolkit versions are 2.4.1
Does this require updates to old Transifex strings? Have the translators been informed?
Does need some changes to old Strings