chickendude / Natibo

Breathe new life into your Glossika PDF/MP3 courses!
The Unlicense
26 stars 3 forks source link

Stop timer when stopping audio #25

Closed jubalh closed 5 years ago

jubalh commented 5 years ago

Currently the timer continues to count down when one presses the pause button.

chickendude commented 5 years ago

The timer has a bunch of issues, some of them were hotfixed on the master branch, but i haven't provided an updated apk for that yet as i've been working on the triangulation update. I'll look into this issue again once i've merged the new update onto master to see if it's still an issue. A lot of other bugs have been fixed in the refactorization so far.

chickendude commented 5 years ago

Could you check if you can still reproduce this on the latest build? It seems to be working for me now, but in the past i've noticed sometimes the timer works, sometimes it doesn't. If you can still reproduce it, it'd be great if you could provide some steps to reproduce it reliably!

jubalh commented 5 years ago

Will try later :)

jubalh commented 5 years ago

Although the timer does some strange jumping in general (freezing for a while then displaying the change that actually happened in one go) it now stops when pausing.

Thanks :-)

chickendude commented 5 years ago

Yeah, that's because the time remaining gets recounted after each rep, but it takes a while to count the size of each mp3 file (i guess, but that's where the slowdown happens in the code) so i put it in a background thread and update the UI when it's done. I think saving the length in ms of the mp3 file directly as a field in the Sentence object would speed this up a lot, but i haven't tried it out yet.

jubalh commented 5 years ago

I think saving the length in ms of the mp3 file directly as a field in the Sentence object would speed this up a lot, but i haven't tried it out yet.

Sounds like a good idea.

chickendude commented 5 years ago

Just implemented this in 71a4a30225af564b0ab8d95f96f8d71c29878923, i added a "timeInMillis" field to the Sentence object which gets filled in when importing a gls file.

jubalh commented 5 years ago

There is a bug here.

When I press 'pause' and exactly in the moment the new sentences appear but the audio doenst play yet, and then press 'play' again the time jumps up (+ X minutes, probably depending on the sentence).

chickendude commented 5 years ago

I also saw some issues with the timer when testing just now, i'll try to look at it tomorrow. As this issue seems to be fixed, i've opened a new issue to help me track these pesky timing bugs.