mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
fix: Include song position and duration in widget
Co-authored-by: Mücahit Kaya <kaya-mucahit@outlook.com> Co-authored-by: The Firehawk <firehawk@opayq.net>
This commit is contained in:
parent
cc0e264a17
commit
e81e1a5356
9 changed files with 210 additions and 20 deletions
|
|
@ -394,12 +394,16 @@ class MediaService : MediaLibraryService() {
|
|||
val artist = mi?.mediaMetadata?.artist?.toString()
|
||||
?: mi?.mediaMetadata?.extras?.getString("artist")
|
||||
val coverId = mi?.mediaMetadata?.extras?.getString("coverArtId")
|
||||
val position = player.currentPosition.takeIf { it != C.TIME_UNSET } ?: 0L
|
||||
val duration = player.duration.takeIf { it != C.TIME_UNSET } ?: 0L
|
||||
WidgetUpdateManager.updateFromState(
|
||||
this,
|
||||
title ?: "",
|
||||
artist ?: "",
|
||||
coverId,
|
||||
player.isPlaying
|
||||
player.isPlaying,
|
||||
position,
|
||||
duration
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue