diff --git a/Armadillo/src/main/java/com/scribd/armadillo/Reducer.kt b/Armadillo/src/main/java/com/scribd/armadillo/Reducer.kt index 5f60b77..e7290d2 100644 --- a/Armadillo/src/main/java/com/scribd/armadillo/Reducer.kt +++ b/Armadillo/src/main/java/com/scribd/armadillo/Reducer.kt @@ -175,14 +175,25 @@ internal object Reducer { isSeeking = action.isSeeking, seekTarget = action.seekPositionTarget) } else MediaControlState() - + val progress = if (action.seekPositionTarget != null) { + playbackInfo.progress.copy(positionInDuration = 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) + val progress = if (action.seekPositionTarget != null) { + playbackInfo.progress.copy(positionInDuration = action.seekPositionTarget) + } else { + playbackInfo.progress + } oldState.copy(playbackInfo = playbackInfo.copy( + progress = progress, controlState = MediaControlState( isSeeking = true, isFastForwarding = true, @@ -191,7 +202,13 @@ internal object Reducer { } is RewindAction -> { val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) + val progress = if (action.seekPositionTarget != null) { + playbackInfo.progress.copy(positionInDuration = action.seekPositionTarget) + } else { + playbackInfo.progress + } oldState.copy(playbackInfo = playbackInfo.copy( + progress = progress, controlState = MediaControlState( isSeeking = true, isRewinding = true, @@ -200,7 +217,13 @@ internal object Reducer { } is SkipNextAction -> { val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) + val progress = if (action.seekPositionTarget != null) { + playbackInfo.progress.copy(positionInDuration = action.seekPositionTarget) + } else { + playbackInfo.progress + } oldState.copy(playbackInfo = playbackInfo.copy( + progress = progress, controlState = MediaControlState( isSeeking = true, isNextChapter = true, @@ -209,7 +232,13 @@ internal object Reducer { } is SkipPrevAction -> { val playbackInfo = oldState.playbackInfo ?: throw ActionBeforeSetup(action) + val progress = if (action.seekPositionTarget != null) { + playbackInfo.progress.copy(positionInDuration = action.seekPositionTarget) + } else { + playbackInfo.progress + } oldState.copy(playbackInfo = playbackInfo.copy( + progress = progress, controlState = MediaControlState( isSeeking = true, isPrevChapter = true,