Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX : Progress not updating issue in Notification Controls #16

Open
muralivitt opened this issue Apr 25, 2021 · 1 comment
Open

FIX : Progress not updating issue in Notification Controls #16

muralivitt opened this issue Apr 25, 2021 · 1 comment

Comments

@muralivitt
Copy link

muralivitt commented Apr 25, 2021

Issue : Issue is duration is in seconds and progress is in milliseconds (x1000) so always progress is greater than total duration.

Fix : Set duration as below

    private fun getMetadata(media: Media?): MediaMetadataCompat {
        val duration = (media?.duration?:0)*1000                             // <---------- Fix
        return MediaMetadataCompat.Builder()
            .putString(MediaMetadataCompat.METADATA_KEY_ART_URI, media?.image)
            .putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, media?.title)
            .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, media?.artist)
            .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_URI, media?.streamUrl)
            .putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, media?.id?.toString())
            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, duration?.toLong())    // <---------- Fix
            .build()
    }
@muralivitt
Copy link
Author

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant