Hi!
I get personal recommendations MusicItemCollection using this code:
func getRecommendations() async throws -> MusicItemCollection<MusicPersonalRecommendation> {
let request = MusicPersonalRecommendationsRequest()
let response = try await request.response()
let recommendations = response.recommendations
return recommendations
}
However, all recommendations contain no more than 12 MusicItem's, while the Music.app application provides much more for some recommendations, for example, for the You recently listened recommendation, the Music.app application displays 40 items. Each recommendation has an items property that contains a collection of musical items MusicItemCollection<MusicPersonalRecommendation.Item>, the hasNextBatch property for these collections is always false. I expected that for some collections loading of new items would be available. Please tell me if I'm doing something wrong or is this a MusicKit bug?
Thank you!
Post
Replies
Boosts
Views
Activity
Hello!
I have a problem with getting album extended info from users library. Note that app authorised to use Apple Music according documentation.
I get albums from users library with this code:
func getLibraryAlbums() async throws -> MusicItemCollection<Album> {
let request = MusicLibraryRequest<Album>()
let response = try await request.response()
return response.items
}
This is an example of Albums request respones:
{
"data" : [
{
"meta" : {
"musicKit_identifierSet" : {
"isLibrary" : true,
"id" : "1945382328890400383",
"dataSources" : [
"localLibrary",
"legacyModel"
],
"type" : "Album",
"deviceLocalID" : {
"databaseID" : "37336CB19CF51727",
"value" : "1945382328890400383"
},
"catalogID" : {
"kind" : "adamID",
"value" : "1173535954"
}
}
},
"id" : "1945382328890400383",
"type" : "library-albums",
"attributes" : {
"artwork" : {
"url" : "musicKit:\/\/artwork\/transient\/{w}x{h}?id=4A2F444C%2D336D%2D49EA%2D90C8%2D13C547A5B95B",
"width" : 0,
"height" : 0
},
"genreNames" : [
"Pop"
],
"trackCount" : 1,
"artistName" : "Сара Окс",
"isAppleDigitalMaster" : false,
"audioVariants" : [
"lossless"
],
"playParams" : {
"catalogId" : "1173535954",
"id" : "1945382328890400383",
"musicKit_persistentID" : "1945382328890400383",
"kind" : "album",
"musicKit_databaseID" : "37336CB19CF51727",
"isLibrary" : true
},
"name" : "Нимфомания - Single",
"isCompilation" : false
}
},
{
"meta" : {
"musicKit_identifierSet" : {
"isLibrary" : true,
"id" : "-8570883332059662437",
"dataSources" : [
"localLibrary",
"legacyModel"
],
"type" : "Album",
"deviceLocalID" : {
"value" : "-8570883332059662437",
"databaseID" : "37336CB19CF51727"
},
"catalogID" : {
"kind" : "adamID",
"value" : "1618488499"
}
}
},
"id" : "-8570883332059662437",
"type" : "library-albums",
"attributes" : {
"isCompilation" : false,
"genreNames" : [
"Pop"
],
"trackCount" : 1,
"artistName" : "TIMOFEEW & KURYANOVA",
"isAppleDigitalMaster" : false,
"audioVariants" : [
"lossless"
],
"playParams" : {
"catalogId" : "1618488499",
"musicKit_persistentID" : "-8570883332059662437",
"kind" : "album",
"id" : "-8570883332059662437",
"musicKit_databaseID" : "37336CB19CF51727",
"isLibrary" : true
},
"artwork" : {
"url" : "musicKit:\/\/artwork\/transient\/{w}x{h}?id=BEA6DBD3%2D8E14%2D4A10%2D97BE%2D8908C7C5FC2C",
"width" : 0,
"height" : 0
},
"name" : "Не звони - Single"
}
},
...
]
}
In AlbumView using task: view modifier I request extended information about the album with this code:
func loadExtendedInfo(_ album: Album) async throws -> Album {
let response = try await album.with([.tracks, .audioVariants, .recordLabels], preferredSource: .library)
return response
}
but in the response some of the fields are always nil, for example recordLabels, releaseDate, url, editorialNotes, copyright.
Please tell me what I'm doing wrong?
My NavigationSplitView is very simple. The DetailView contains Table populated with data. SideBar populated with items that act as a filter for Table content. If I'm on the SideBar and hit Command-A, I never want to select everything in the sidebar. I always want to select all the content for a detail view. This is how Finder works.
I tried to set
List(...) {
...
}
.focusable(false)
When I launch the application, Command-A works exactly as I would like. But when I select another "filter" in sidebar with the mouse, the List becomes focusable.
Good day.
I'm having problems debugging hangs. Watched the video WWDC Analyze hangs with Instruments. Apparently the main thread is blocked. It’s just not possible to analyze what exactly is blocking the flow. Please help me figure it out.
https://drive.google.com/file/d/1QvFK4y79CG0fBMrJPOrBCTuWsOaqichY/view?usp=share_link <- trace
Hello.
As described in the title - NSWorkspace launch and activate application despite activates property of OpenConfiguration set to false.
I want to launch Safari Extension Container (main application) as helper:
func launchMainApp() {
guard let mainAppAsHelperURL = NSWorkspace.shared.urlForApplication(withBundleIdentifier: mainAppBundleIdentefier) else { return }
let openConfiguration = NSWorkspace.OpenConfiguration()
openConfiguration.activates = false
NSWorkspace.shared.openApplication(at: mainAppAsHelperURL, configuration: openConfiguration, completionHandler: { mainApp, err in
if let error = err {
DispatchQueue.main.async {
let alert = NSAlert(error: error)
alert.runModal()
}
} else {
Self.mainApp = mainApp
}
})
}
The Safari Extension have popover. Launching helper performed when the popover shown:
override func popoverWillShow(in window: SFSafariWindow) {
if Self.mainApp == nil {
log(name: "Launch Mainapp as helper", t: "")
launchMainApp()
}
}
The popover opens and immediately closes and Safari becomes inactive. This is not the result I was expecting.
But this happening when application installed from TestFlight. When i build app on my mac and open extension’s popover by clicking icon in Safari toolbar everything ok, helper launches and popover stay opened.
Please help me resolve these issues.
Thank you.
Hi. How to get access to static method currentEntitlements in Transaction directly from safari extension. Safari extension haven’t in app purchases capabilities.
Open music.yandex.ru
Open browser console
Paste this code:
navigator.mediaSession.metadata = new MediaMetadata({
title: "11111111111",
artist: "222222222",
album: "3333333333",
artwork: [
{ src: "https://avatars.yandex.net/get-music-content/5375761/c8e05100.a.19837155-1/200x200" }
]});
Open Now playing widget.
Title, artist, album is set correctly. Cover not set.
macOS 13.0.1 (22A400) Safari 16.1 (18614.2.9.1.12)
Note! In macOS 12.6.1 Safari 15.6.1 (17613.3.9.1.16) all works as expected.
I want to disable a widget Now playing for a specific website. Can this be done with an injected script or with the standard macOS libraries?
Hello.
I’m working on safari app extension which control playback mediatems in music.yandex.com service. Unfortunately keyboard media keys does’t support yandex music service. It is possible to override system player events for safari?
I planned to make my app a Now Playing App, but when playing media in safari, the browser itself becomes Now Playing App and intercepts media key events. Can this behavior be overridden?
Thank you.