I'm developing a media player for Mac (AppKit, not Catalyst) that plays local and remote content. I have AirPlay working with AVPlayer (with an AVRoutePickerView assigning the route), but while I get the metadata that I've set for the MPNowPlayingInfoCenter on the AirPlay device (a TV in this case), I don't get any album art (but I do in the macOS now playing menu bar/control centre applet). It looks like this: (imgur link because I can't get it to upload in the forum): https://i.imgur.com/2JBIYCw.jpg
My code for setting the metadata:
NSImage *artwork = [currentTrack coverImage];
CGSize artworkSize = [artwork size];
MPMediaItemArtwork *mpArtwork = [[MPMediaItemArtwork alloc] initWithBoundsSize:artworkSize requestHandler:^NSImage * _Nonnull(CGSize size) {
return artwork;
}];
[songInfo setObject: mpArtwork forKey:MPMediaItemPropertyArtwork];
I noticed that it doesn't resize, but it seems at least macOS doesn't care. I tried modifying the code to resize the artwork in the callback, but that also doesn't change anything.
I noticed in the logs that I get a message about a missing entitlement:
2023-01-29 14:00:37.889346-0400 Submariner[42682:9794531] [Entitlements] MSVEntitlementUtilities - Process Submariner PID[42682] - Group: (null) - Entitlement: com.apple.mediaremote.external-artwork-validation - Entitled: NO - Error: (null)
...however, this seems to be a private entitlement and the only reference I can find to it is WebKit. Using it makes LaunchServices very angry at me, and I presume it's a red herring.
Post
Replies
Boosts
Views
Activity
I'm trying to use the new .formStyle(.insetGrouped), as mentioned in the WWDC 2022 presentation "What's new in AppKit". However, I don't see it in the documentation for FormStyle, and the following code below fails to compile because it's not a member:
import AppKit
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
@State var text = ""
@State var toggle = false
var body: some View {
Form {
TextField("Text", text: $text)
Toggle("Toggle", isOn: $toggle)
}
.formStyle(.insetGrouped)
}
}
PlaygroundPage.current.setLiveView(ContentView())
Am I missing something here (i.e. declaring some SDK version)?