Skip to content

Commit

Permalink
more granular seek setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ericleb010 authored and nielsvanvelzen committed Aug 24, 2024
1 parent 8cca272 commit c03bec8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CustomSeekProvider(
private val videoPlayerAdapter: VideoPlayerAdapter,
) : PlaybackSeekDataProvider() {
companion object {
private const val SEEK_LENGTH = 30000L
private const val SEEK_LENGTH = 10000L
}

override fun getSeekPositions(): LongArray {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ class CustomSeekProviderTests : FunSpec({
test("CustomSeekProvider.seekPositions with simple duration") {
val videoPlayerAdapter = mockk<VideoPlayerAdapter> {
every { canSeek() } returns true
every { duration } returns 90000L
every { duration } returns 30000L
}
val customSeekProvider = CustomSeekProvider(videoPlayerAdapter)

customSeekProvider.seekPositions shouldBe arrayOf(0L, 30000L, 60000L, 90000L)
customSeekProvider.seekPositions shouldBe arrayOf(0L, 10000L, 20000L, 30000L)
}

test("CustomSeekProvider.seekPositions with odd duration") {
val videoPlayerAdapter = mockk<VideoPlayerAdapter> {
every { canSeek() } returns true
every { duration } returns 130000L
every { duration } returns 45000L
}
val customSeekProvider = CustomSeekProvider(videoPlayerAdapter)

customSeekProvider.seekPositions shouldBe arrayOf(0L, 30000, 60000, 90000, 120000, 130000)
customSeekProvider.seekPositions shouldBe arrayOf(0L, 10000, 20000, 30000, 40000, 45000)
}

test("CustomSeekProvider.seekPositions with seek disabled") {
Expand Down

0 comments on commit c03bec8

Please sign in to comment.