Skip to content

Native Android client for Spotify, built with Jetpack Compose

Canvas: controller off before the player is set, no more prev/next flash

kota-zob4019f0916be
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5d86136..3de829f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ Each release on GitHub shows its section below. The app shows it too when it off
- **Fast scrollbar** on long playlists and the library.
- **Share as image** (Instagram story and more); swipe up on the cover for the lyrics; player fits foldables and wide screens.
- **Settings**: autoplay on or off, accent colour, screen rotation (portrait, automatic, landscape).
+- **Canvas**: the video's previous / next buttons no longer flash when you come back to the player.
## 2.0.0-beta.6
diff --git a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
index 79837997..7e822799 100644
--- a/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
+++ b/base/app/src/main/java/com/music/spotui/ui/screens/PlayerScreen.kt
@@ -1261,9 +1261,10 @@ private fun CanvasVideo(url: String, playing: Boolean, modifier: Modifier = Modi
update = { it.player = exo },
factory = { ctx ->
androidx.media3.ui.PlayerView(ctx).apply {
- player = exo
// Strip ALL chrome: no controller, no buffering spinner, and no
// artwork/placeholder icon (that "play icon" overlay) — just video.
+ // The controller goes off before the player is set: a player given to a
+ // view with its controller on shows the prev / next buttons for a moment.
useController = false
controllerAutoShow = false
setShowBuffering(androidx.media3.ui.PlayerView.SHOW_BUFFERING_NEVER)
@@ -1276,6 +1277,7 @@ private fun CanvasVideo(url: String, playing: Boolean, modifier: Modifier = Modi
// Until a clip's first frame, show the screen behind, not a black shutter.
setShutterBackgroundColor(android.graphics.Color.TRANSPARENT)
setKeepContentOnPlayerReset(true)
+ player = exo
}
},
)