Posts

Post not yet marked as solved
0 Replies
39 Views
Specifically, when the song is cut in the background, or when we open our APP after cutting the song through the music APP, the song cover built with ArtworkImage does not have any display, why is this? I have ensured that the artwork of the song is not nil and set the size, here is my application code: public func updateUI() {     coverImgView.subviews.forEach { $0.removeFromSuperview() }           let imageView = PlayerCoverImageView(artwork: artwork, size: size)     let viewCtl = UIHostingController(rootView: imageView)     viewCtl.view.frame = coverImgView.bounds     viewCtl.view.backgroundColor = .clear     coverImgView.addSubview(viewCtl.view)   } @available(iOS 15.0, *) struct PlayerCoverImageView: View {       var artwork: Artwork?   var size: CGSize       var body: some View {     if let artwork = artwork {       createCover(with: artwork)     } else {       EmptyView()     }   }       private func createCover(with artwork: Artwork) -> some View {     print("[*******] \(artwork), \(size)")     let width = size.width; let height = size.height     return ArtworkImage(artwork, width: width,               height: height)   } } console output: Artwork(   urlFormat: "musicKit://artwork/library/56D232E0-6CE5-40B5-92C3-CFEEC00D9CA6/{w}x{h}?at=item&mt=music&fat=https://is4-ssl.mzstatic.com/image/thumb/Music115/v4/45/8a/e4/458ae484-dc8b-5683-ce04-8d2948346462/JAY.jpg/1125x1229bb.jpg&id=6762479945777034135&fas=subscription&lid=56D232E0-6CE5-40B5-92C3-CFEEC00D9CA6",   maximumWidth: 0,   maximumHeight: 0 ) (307.0, 307.0)
Posted
by ArvinYang.
Last updated
.