Artwork doesn't always show-up in chromium-based browsers #2
Open
Description
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 typeproperties
of theartwork
property itself does not appear to force a refresh unlike with modifyingtitle
. - Directly modifying the
sizes
property or creating a newartwork
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"
}
]