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

[Jetcaster] Allow Slider seeking player #1374

Merged
merged 3 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -103,6 +103,16 @@ interface EpisodePlayer {
*/
fun rewindBy(duration: Duration)

/**
* Signal that user started seeking.
*/
fun onSeekingStarted()

/**
* Seeks to a given time interval specified in [duration].
*/
fun onSeekingFinished(duration: Duration)

/**
* Increases the speed of Player playback by a given time specified in [duration].
*/
Expand Down
Expand Up @@ -173,6 +173,17 @@ class MockEpisodePlayer(
}
}

override fun onSeekingStarted() {
// Need to pause the player so that it doesn't compete with timeline progression.
pause()
}

override fun onSeekingFinished(duration: Duration) {
val currentEpisodeDuration = _currentEpisode.value?.duration ?: return
timeElapsed.update { duration.coerceIn(Duration.ZERO, currentEpisodeDuration) }
play()
}

override fun increaseSpeed(speed: Duration) {
_playerSpeed.value += speed
}
Expand Down