I’ve been trying to update the artwork shown for an item in MPNowPlayingInfoCenter
using MPMediaItemPropertyArtwork
as shown in the following code taken from Apple’s docs
if let image = UIImage(named: "image_here") {
nowPlayingInfo[MPMediaItemPropertyArtwork] =
MPMediaItemArtwork(boundsSize: image.size) { size in
return image
}
}
The issue I’m having is that this sets a smaller image as shown in the photo below in the red square. I’m trying to figure out how to set the image in the larger yellow square, and I can’t find any documentation that differentiates between the two.
EDIT
vint’s answer below clarified that the smaller icon is the app icon. I am however setting the nowPlayingInfo dictionary successfully since my other metadata is reaching the lock screen controls, like the title (blurred), duration, elapsed playback time). It’s just the artwork that appears to not being working.
2
Answers
Just in case anyone finds this question and was going crazy like myself, I was able to set the image by correctly resizing my
UIImage
to the incomingsize
parameter given to theMPMediaItemArtwork
callback function. As it says in the docs:Then setting my
image
to the incomingsize
parameter with the following extension, theMPMediaItemPropertyArtwork
was finally successfully set.Obviously you did not successfully set the cover image of the track to
MPNowPlayingInfoCenter
, The image in red square is your app icon, this isMPNowPlayingInfoCenter
‘s default behavior,I guess you lost the next step
If you has set that, you should find the failed reason, seed this answer