Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APT-10128] Fixed the order of dispatched actions during seek related… #34

Merged

Conversation

griffinfscribd
Copy link
Contributor

@griffinfscribd griffinfscribd commented Jun 6, 2024

… events

Currently the order of the actions dispatched on a seeking action:

  1. Intial Seeking action (Skip distance, Prev chapter, seek position, etc.)
  2. Finish Seeking action because we immediately call exoplayer to seek to the new position and this triggers the Seek listeners with the current armadillo state without playback info being updated.
  3. Then dispatch PlaybackProgressAction with the new position that updates the armadillo state's playback info

Instead we reverse the order of the final seek action and PlaybackProgressAction so we are able to update the playback info progress before the finish seek occurs so it has the correctly updated playback info just before the listeners are triggered.

I also think that the PlaybackProgressAction order in the original code was likely misordered in the first place.
Normally, the PlaybackProgressAction gets fired a few times a second whether paused or playing that gets the exoplayer position, and updates the playback info progress with it. Having it run at the end of the sequence of events is redundant since it'll happen anyway. I think it might be that the intention was to use PlaybackProgressAction to update the playback info progress BEFORE the last finishing seek action is dispatched so it has the right progress that matches the finished seek position.

Changing this order now correctly sends the updated seek position to the audio player app for all the discontinuous jumps we make while paused and correctly saves the progress whether closing the audio player or force closing while paused.

… events

Currently the order of the actions dispatched on a seeking action:
Intial Seeking action (Skip distance, Prev chapter, seek position, etc.)
Finish Seeking action because we immediately call exoplayer to seek to the new position and this triggers the Seek listeners with the current armadillo state without playback info being updated.
Then dispatch PlaybackProgressAction with the new position that updates the armadillo state's playback info

Instead we reverse the order of the finish seek action and PlaybackProgressAction so we are able to update the playback info progress before the finish seek occurs so it has the correctly updated playback info
@griffinfscribd griffinfscribd marked this pull request as ready for review June 6, 2024 17:30
@griffinfscribd griffinfscribd merged commit 67d37df into main Jun 6, 2024
6 checks passed
@griffinfscribd griffinfscribd deleted the griffinf/APT-10128-update-seeking-playback-progress branch June 6, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants