mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
drop the first-play pre-buffering
It made no perceivable difference to the first-play hitch, so it only cost buffering audio at launch that the user may never play. loadWindow prepares when it plays again, and the two tests go back to their original assertions.
This commit is contained in:
@@ -705,8 +705,10 @@ class PlaybackController(
|
||||
updating = true
|
||||
player.setWindow(window.map { it.item.toQueueItem() }, startIndex, startPositionMs)
|
||||
updating = false
|
||||
player.prepare()
|
||||
if (autoplay) player.play()
|
||||
if (autoplay) {
|
||||
player.prepare()
|
||||
player.play()
|
||||
}
|
||||
refresh(position)
|
||||
}
|
||||
|
||||
|
||||
@@ -145,20 +145,18 @@ class PlaybackControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRestoredQueueIsPreparedBeforeTheFirstPlay() {
|
||||
fun togglingPlayOnARestoredQueuePreparesBeforePlaying() {
|
||||
seedAlbum(5, sourceId = 1)
|
||||
runBlocking { queues.replace(listOf(queues.albumEntry(1, "al1"))) }
|
||||
|
||||
controller.connect()
|
||||
await { handle.items.isNotEmpty() }
|
||||
await { handle.operations.contains("prepare") }
|
||||
|
||||
handle.operations.clear()
|
||||
|
||||
controller.togglePlayPause()
|
||||
await { handle.operations.contains("play") }
|
||||
|
||||
assertEquals(listOf("play"), handle.operations)
|
||||
assertEquals(listOf("prepare", "play"), handle.operations)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1081,9 +1079,7 @@ class PlaybackControllerTest {
|
||||
|
||||
assertEquals(33_000L, handle.positionMs)
|
||||
assertFalse(handle.playWhenReady)
|
||||
val reload = handle.operations.drop(before)
|
||||
assertTrue("a reload must re-prepare, or the next play pays for it", reload.any { it == "prepare" })
|
||||
assertTrue(reload.none { it == "play" })
|
||||
assertTrue(handle.operations.drop(before).none { it.startsWith("prepare") || it.startsWith("play") })
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user