|
|
@@ -181,10 +181,12 @@ class JellyfinPlaybackBridge(
|
|
|
)
|
|
|
putInt("playlistLength", rawItems.size)
|
|
|
}
|
|
|
+ val durationMs = (item["durationMs"] as? Number)?.toLong() ?: 0L
|
|
|
val metadata = MediaMetadata.Builder()
|
|
|
.setTitle(item["title"] as? String)
|
|
|
.setArtist(item["artist"] as? String)
|
|
|
.setAlbumTitle(item["album"] as? String)
|
|
|
+ .setDurationMs(durationMs)
|
|
|
.setExtras(extras)
|
|
|
.apply {
|
|
|
if (artwork != null && artwork.isNotEmpty()) {
|
|
|
@@ -227,7 +229,14 @@ class JellyfinPlaybackBridge(
|
|
|
val item = controller.currentMediaItem ?: return mapOf("available" to false)
|
|
|
val metadata = item.mediaMetadata
|
|
|
val extras = metadata.extras
|
|
|
- val duration = if (controller.duration > 0) controller.duration else 0L
|
|
|
+ // Jellyfin's progressive/transcoded audio often has no duration in
|
|
|
+ // ExoPlayer. Keep the queued track duration as the ring denominator.
|
|
|
+ val fallbackDuration = (metadata.durationMs ?: 0L).coerceAtLeast(0L)
|
|
|
+ val duration = if (controller.duration > 0) {
|
|
|
+ controller.duration
|
|
|
+ } else {
|
|
|
+ fallbackDuration
|
|
|
+ }
|
|
|
return mapOf(
|
|
|
"available" to true,
|
|
|
"playing" to controller.isPlaying,
|