I am building an app with AVKit and MediaPlayer and want to show a cover in the control center. Using this code didn't worked for me:
if let image = UIImage(named: "myCover") {
nowPlayingInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: image.size) { size in
return image
}
}
First, I thought that downloading the UI Image failed, but then i realised that this issue also happend when using a locally saved image.
By the way: Setting up the player (pause/play/background mode) worked fine.
I am using iOS 16 and Xcode 14.0.1.
where is your nowPlayingInfo coming from ? In my process I declare a new dictionary with titles and stuff then I process my image later with async download using
MPNowPlayingInfoCenter.default().nowPlayingInfo?[MPMediaItemPropertyArtwork] = artwork
I mean if you directly set it in the default Center is it still not showing ?