mattttvaughn / chronicle

GNU General Public License v3.0
222 stars 59 forks source link

Bug - End of Chapter Sleep Timer doesn't work w/ Modified Playback Speed #101

Open some-guy-23 opened 2 years ago

some-guy-23 commented 2 years ago

It appears when choosing "end of chapter" in the sleep timer, it doesn't take into account the current playback speed. So if you are listening at 1.2x, and the chapter is 30 minutes long, it will play for exactly 30 minutes, going past the end of the chapter.

some-guy-23 commented 2 years ago

Looking into this more, and it is actually adding additional time to the "end of chapter" sleep timer when Playback speed is higher than 1x. This is an order-of-operations issues with the math involved calculating remaining time, since it is doing the division first - https://github.com/mattttvaughn/chronicle/blob/develop/app/src/main/java/io/github/mattpvaughn/chronicle/features/currentlyplaying/CurrentlyPlayingViewModel.kt#L602

I've created a PR w/ the simple fix here - https://github.com/mattttvaughn/chronicle/pull/102