Skip to content

Notification Image Not Updating #964

@Tr736

Description

@Tr736

Version

Media3 1.2.0

More version details

I am using a MediaLibrarySession and Controller.

Im wanting to update the lockscreen/notification image dynamically

This is the code I am using...

` fun updateNowPlayingMetadata(call: MethodCall, result: Result) {
val artworkUri = BundleUtils.parseMethodCall(call)?.getString("image")?.let { Uri.parse(it) }
Log.d("MediaController", "updateNowPlayingMetadata $artworkUri")

    val updatedItem = controller?.currentMediaItem?.buildUpon()?.apply {
        setMediaMetadata(MediaMetadata.Builder()
        .setArtworkUri(artworkUri)
        .build())
    }?.build()

    updatedItem?.let {
        controller?.replaceMediaItem(0, it)
        MediaItemTree.addItem(it)
    }

    result.success(null)
}`

and in my PlaybackService: MediaLibraryService

// ============================================================ // updateNotification fun updateNotification(){ Log.d("PlaybackService", "updateNotification ") onUpdateNotification(Settings.session!!, false) }

If I set the title during the update, the title changes, but the image remains the same. I've confirmed multiple times that the imageURL is changing to what I expect, but the issue is that the images don't change.

Devices that reproduce the issue

Pixel 5

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Play a library item and notice the original image in the Lock Screen
Update the image
Notice the Lock Screen image dosnt change

Expected result

Lockscreen/ Notification Image should change

Actual result

Lockscreen / notification image remains as the initial image

Media

you can do this with any two image urls during playback

Bug Report

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions