-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,14 +175,24 @@ internal object Reducer { | |
isSeeking = action.isSeeking, | ||
seekTarget = action.seekPositionTarget) | ||
} else MediaControlState() | ||
|
||
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 commentThe 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? |
||
currentChapterIndex = playbackInfo.audioPlayable.getChapterIndexAtOffset(action.seekPositionTarget)) | ||
} else { | ||
playbackInfo.progress | ||
} | ||
oldState.copy(playbackInfo = playbackInfo.copy( | ||
progress = progress, | ||
controlState = controlState)) | ||
.apply { debugState = newDebug } | ||
} | ||
is FastForwardAction -> { | ||
val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) | ||
oldState.copy(playbackInfo = playbackInfo.copy( | ||
progress = playbackInfo.progress.copy( | ||
positionInDuration = action.seekPositionTarget, | ||
currentChapterIndex = playbackInfo.audioPlayable.getChapterIndexAtOffset(action.seekPositionTarget)), | ||
controlState = MediaControlState( | ||
isSeeking = true, | ||
isFastForwarding = true, | ||
|
@@ -192,6 +202,9 @@ internal object Reducer { | |
is RewindAction -> { | ||
val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) | ||
oldState.copy(playbackInfo = playbackInfo.copy( | ||
progress = playbackInfo.progress.copy( | ||
positionInDuration = action.seekPositionTarget, | ||
currentChapterIndex = playbackInfo.audioPlayable.getChapterIndexAtOffset(action.seekPositionTarget)), | ||
controlState = MediaControlState( | ||
isSeeking = true, | ||
isRewinding = true, | ||
|
@@ -201,6 +214,9 @@ internal object Reducer { | |
is SkipNextAction -> { | ||
val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) | ||
oldState.copy(playbackInfo = playbackInfo.copy( | ||
progress = playbackInfo.progress.copy( | ||
positionInDuration = action.seekPositionTarget, | ||
currentChapterIndex = playbackInfo.audioPlayable.getChapterIndexAtOffset(action.seekPositionTarget)), | ||
controlState = MediaControlState( | ||
isSeeking = true, | ||
isNextChapter = true, | ||
|
@@ -210,6 +226,9 @@ internal object Reducer { | |
is SkipPrevAction -> { | ||
val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) | ||
oldState.copy(playbackInfo = playbackInfo.copy( | ||
progress = playbackInfo.progress.copy( | ||
positionInDuration = action.seekPositionTarget, | ||
currentChapterIndex = playbackInfo.audioPlayable.getChapterIndexAtOffset(action.seekPositionTarget)), | ||
controlState = MediaControlState( | ||
isSeeking = true, | ||
isPrevChapter = true, | ||
|
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 inSeekAction
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.