feat(library): genre sliders, artist links, and navigation utils
- music landing: diverse per-genre album sliders (online counts / offline wide-probe fallback) and home-screen library shortcuts - add ArtistLinks component and shared navigation/genreDiversity utils - player/playback-mode refinements across Rust and frontend
This commit is contained in:
@@ -138,6 +138,15 @@ class JellyTauPlayer(private val appContext: Context) {
|
||||
/** Current media ID being played */
|
||||
private var currentMediaId: String? = null
|
||||
|
||||
/**
|
||||
* Guards against nativeOnPlaybackEnded() firing more than once per loaded
|
||||
* media. ExoPlayer can re-enter STATE_ENDED (e.g. transient buffering near
|
||||
* end of a transcoded stream), which would otherwise notify the backend
|
||||
* twice and, for example, decrement the sleep-timer episode counter twice.
|
||||
* Reset whenever new media is loaded.
|
||||
*/
|
||||
private var endedNotified = false
|
||||
|
||||
/** Current media metadata for notification updates */
|
||||
private var currentTitle: String = ""
|
||||
private var currentArtist: String = ""
|
||||
@@ -208,7 +217,15 @@ class JellyTauPlayer(private val appContext: Context) {
|
||||
// Playback completed
|
||||
android.util.Log.d("JellyTauPlayer", "▶ Playback ended")
|
||||
stopPositionUpdates()
|
||||
nativeOnPlaybackEnded()
|
||||
// Only notify the backend once per loaded media. ExoPlayer
|
||||
// can re-enter STATE_ENDED, which would double-count things
|
||||
// like the sleep-timer episode counter.
|
||||
if (!endedNotified) {
|
||||
endedNotified = true
|
||||
nativeOnPlaybackEnded()
|
||||
} else {
|
||||
android.util.Log.d("JellyTauPlayer", "▶ Playback ended already notified - ignoring")
|
||||
}
|
||||
}
|
||||
Player.STATE_BUFFERING -> {
|
||||
android.util.Log.d("JellyTauPlayer", "▶ Buffering...")
|
||||
@@ -322,6 +339,7 @@ class JellyTauPlayer(private val appContext: Context) {
|
||||
fun load(url: String, mediaId: String) {
|
||||
mainHandler.post {
|
||||
currentMediaId = mediaId
|
||||
endedNotified = false
|
||||
val mediaItem = MediaItem.fromUri(url)
|
||||
exoPlayer.setMediaItem(mediaItem)
|
||||
exoPlayer.prepare()
|
||||
@@ -552,6 +570,7 @@ class JellyTauPlayer(private val appContext: Context) {
|
||||
) {
|
||||
mainHandler.post {
|
||||
currentMediaId = mediaId
|
||||
endedNotified = false
|
||||
|
||||
// Store metadata for notification updates
|
||||
currentTitle = title
|
||||
|
||||
Reference in New Issue
Block a user