[webkit-changes] [WebKit/WebKit] cbbcae: MediaSession artwork only uses the first item in t...
Jean-Yves Avenard
noreply at github.com
Tue Jul 9 20:27:33 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cbbcae6e1ae3ca3c2b11a499fa133b07746e2820
https://github.com/WebKit/WebKit/commit/cbbcae6e1ae3ca3c2b11a499fa133b07746e2820
Author: Jean-Yves Avenard <jya at apple.com>
Date: 2024-07-09 (Tue, 09 Jul 2024)
Changed paths:
M Source/WebCore/Modules/mediasession/MediaMetadata.cpp
M Source/WebCore/Modules/mediasession/MediaMetadata.h
Log Message:
-----------
MediaSession artwork only uses the first item in the artwork array
https://bugs.webkit.org/show_bug.cgi?id=276351
rdar://81160539
Reviewed by Youenn Fablet.
If `sizes` metadata artwork attribute is provided we will use them to determine the "best"
image to select. We do so by giving each resolution a score between 0 and 1. We aim to download
an image that is 512x512 with an aspect ratio of 1.
If the `sizes` attribute contains invalid content or if not provided, we will iterate through
all the available images and download them. We will then either select the one with the highest
score, or the first one found with a resolution greater than 512 pixels.
Test will be added once https://bugs.webkit.org/show_bug.cgi?id=276133 lands as it adds some
internal APIs to check which URL was selected with Now Playing.
For now, manually tested.
* Source/WebCore/Modules/mediasession/MediaMetadata.cpp:
(WebCore::MediaMetadata::imageDimensionsScore const):
(WebCore::MediaMetadata::refreshArtworkImage):
(WebCore::MediaMetadata::tryNextArtworkImage):
* Source/WebCore/Modules/mediasession/MediaMetadata.h:
Canonical link: https://commits.webkit.org/280804@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list