-
Notifications
You must be signed in to change notification settings - Fork 5
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] Update Reducer logic to copy seek position to playbackinfo #33
Conversation
c0d327c
to
b5a1ea4
Compare
@@ -175,14 +175,29 @@ internal object Reducer { | |||
isSeeking = action.isSeeking, | |||
seekTarget = action.seekPositionTarget) | |||
} else MediaControlState() | |||
|
|||
val progress = if (action.seekPositionTarget != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For most of these, I think seekPositionTarget
should really be non-null. It's only used in SeekAction
to resolve the end of a seek. Can you make it non-null for all the other actions where it's never actually null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not notice that. Sure, I can make that change.
|
||
val progress = if (action.seekPositionTarget != null) { | ||
playbackInfo.progress.copy( | ||
positionInDuration = action.seekPositionTarget, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the question to ask is "Should we consider the user at the new position when they start a discontinuous action like seeking or jumping?" I feel like the answer should be "no", but I'm willing to be convinced it makes sense.
How does the scrubber/UI get updated if you jump while paused? Can we hitch the progress update into whatever makes that update?
d400226
to
4418f8c
Compare
Jira ticket
https://scribdjira.atlassian.net/browse/APT-10128
Description
Bug:
When the audio player is paused and the user performs some combination of audio controls (seeking, chapter jumping, skip fwd back, etc), then force closes the app. The progress is updated, but is not the latest and is not correct. While in the paused state, the user would likely be losing their latest listening progress. This differs from the user closing the audio player in-app because in that scenario, the progress is correctly saved.
Explanation:
After much digging, when the audio player performs some audio control, say Seek, it would trigger the armadillo player to dispatch a Seek Action and the Reducer would update the armadillo state to be emitted to the listeners for said action.
Currently in the Scribd app, whenever the action listener would receive the armadillo state, it would look into
PlaybackInfo.progress.positionInDuration
. If you look at the Reducer in the armadillo player library, you can immediately see that the playbackinfo is not updated, only the controlstate, which is why when we are saving the progress, the progress is not updated to what it should be after performing the media control action. It would make sense to update the playbackinfo following these skips, seeks, etc. since prior to the emission, the exoplayer's position is already updated to where we are skipping.Fix:
Update reducer to update the playbackinfo progress in terms of position and chapter index (we may be able to jump to the next or previous chapter). Now when paused and jumping around the audio, the progress is correctly save the same way whether we close the audio player in-app or force close.
Testing considerations
Introduced unit tests
Regression around audio controls (skip fwd, back, seek, jump to chapter, etc.) leading to progress saved while playing or paused.
Checklist
README.md
as necessaryRelated links