Malformed Artwork property on MusicPlayer.Queue.Entry

I'm trying to use MusicKit in a UIKit app and after adopting the new queue mechanism, I noticed a very weird URL being returned by MusicKit

After digging further, the whole object seem to act strangely, the url starts with musicKit://artwork/albums/ etc, its width and height are both 0 and its colors are sometimes missing.

Unrelated but I have found observing updates outside of SwiftUI relatively complicated, it would be great if you added at least some way to be notified about updates so that we can update our UI accordingly

Hello @svobpata,

Thank you for the feedback on the unexpected data you're getting in the artwork of a MusicPlayer.Queue.Entry.

By and large, what you see there is just as expected, with the exception of the the maximumWidth and maximumHeight set to 0.

Feel free to file a ticket on Feedback Assistant about this specific issue.

That said, I would encourage you to load the artwork with something along those lines:

    if let artworkURL = artwork.url(width: 300, height: 300) {
        let (artworkImageData, _) = try await URLSession.shared.data(from: artworkURL)
        updateArtworkImageView(with: artworkImageData)
    }

where updateArtworkImageView is defined as:

private func updateArtworkImageView(with artworkImageData: Data) {
    artworkImageView.image = UIImage(data: artworkImageData)
}

Despite the unusual look of the underlying URL, this is designed to work just fine when you pass this URL to URLSession.

As for the ergonomics of using these APIs with UIKit, I hear you, but we are definitely focused on making MusicKit for Swift easy to use with SwiftUI first and foremost.

For example, you can always use MusicPlayer.Queue's objectWillChange publisher to get notified of changes to the playback queue.

I hope this helps.

Best regards,

Malformed Artwork property on MusicPlayer.Queue.Entry
 
 
Q