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

Artwork doesn't always show-up in chromium-based browsers #2

Open
snaphat opened this issue Dec 16, 2023 · 1 comment
Open

Artwork doesn't always show-up in chromium-based browsers #2

snaphat opened this issue Dec 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@snaphat
Copy link
Owner

snaphat commented Dec 16, 2023

In some cases when chromium-based browsers are backgrounded, the specific artwork will not display in the media-session.

This appears to be related to the issue mitigated in revision 2e0a50e where-in chromium-based browsers are (perhaps?) not sending updated metadata to the OS.

It seems the only work-around for this is to employ a similar trick to the above commit to force a refresh in some manner:

navigator.mediaSession.metadata = null

The issue with the former is that it causes very noticeable flashes in the media session display and cannot be employed at a 1s update interval to mitigate the issue as a result.

  • Directly modifying the src and type properties of the artwork property itself does not appear to force a refresh unlike with modifying title.
  • Directly modifying the sizes property or creating a new artwork object with a different sizes property appears to force a refresh.
navigator.mediaSession.metadata.title =  ... // this works if the title changes (the employed mitigation adds a space to the title every other update)

navigator.mediaSession.metadata.artwork.src = ... // this does not work even if the source changes
navigator.mediaSession.metadata.artwork.type = ... // this does not work even if the type changes

navigator.mediaSession.metadata.artwork.sizes = ... // this appears to work if the size changes

navigator.mediaSession.metadata.artwork = [
    {
        "sizes": ..., // this appears to work if the size changes
        "src": "https://mediaserver-cont-usc-mp1-1-v4v6.pandora.com/images/65/89/6b/0c/5dcc41b28ee9ba51bea415b9/500W_500H.jpg",
        "type": "image/jpeg"
    }
]
@snaphat
Copy link
Owner Author

snaphat commented Dec 16, 2023

This issue probably also needs to be mitigated for artist and album properties as well. The same mitigation technique as with the title updates can employed there.

@snaphat snaphat added the bug Something isn't working label Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant