I'm running into something I'm pretty sure is a bug but can't be certain. I'm making a MusicCatalogSearchRequest and one of the songs I get in the response is "Something New" by "Girls Aloud", album is "Ten".
This is the song's playParameters:
play parameters: Optional(MusicKit.PlayParameters(id: 1440812580, kind: "song", isLibrary: nil, catalogID: Optional(MusicKit.MusicCatalogID(value: 1440812580, kind: MusicKit.MusicCatalogID.Kind.subscriptionAdamID)), libraryID: nil, deviceLocalID: Optional(MusicKit.MusicDeviceLocalID(value: 6462662101513281989, databaseID: 630DDCB4-9B32-44F8-9AFE-77207DB44011)), rawValues: [:]))
That song is actually already part of my library but it's grayed out and it can't be played. (I'm making an app to replace unplayable songs like this one, and replace them with working versions.)
When I make a request to get all my library songs, MusicLibraryRequest(), that song's Song object looks like this:
Song(
id: "i.Xr2VHvm2DoE",
title: "Something New",
albumTitle: "Ten",
artistName: "Girls Aloud",
composerName: "Miranda Cooper, Brian Higgins, Tim Powell, Nick Coler, Jodie Lei & Giselle Sommerville",
contentRating: .clean,
discNumber: 1,
duration: 199.992,
hasLyrics: false,
movementCount: 0,
movementNumber: 0,
trackNumber: 1
)
(Notice the playParameters are missing, which is why the song can't be played.)
HOWEVER, using postman, when I search for a library song with that library id, I get a 'Resource with requested id was not found' 404 error.
https://api.music.apple.com/v1/me/library/songs/i.XMez8Svm2DoE
{
"errors": [
{
"id": "J63D7SDTXLJKEQMZGSZD7RUXVQ",
"title": "Resource Not Found",
"detail": "Resource with requested id was not found",
"status": "404",
"code": "40400"
}
]
}
I then add that song (the one I got from MusicLibraryRequest()) to a playlist in my icloud library, but on the device I see it grayed out and it can't be played.
From what I see happening with other unplayable songs, the unplayable versions don't show up in the response when I make a MusicCatalogSearchRequest.
When I search for this same song in the official Music.app on my iPhone and make the same search, I find the song and see the option to 'add to library'. I do that but the song isn't added. When I open the menu, instead of seeing the option to delete from library or download to my device, I see the option to 'add to library' again. The thing that is failing here is that it's giving me the option to add to library even though the song is already on my library. HOWEVER, from the catalog search results list, I can play the song. Which I can't when I look for it in my library.
So:
A song in my iCloud library can't be played (it doesn't have any playParameters data)
Making a CatalogSearchRequest with its 'title' and 'artistName' returns me that same unplayable version that is already in my library (even though this doesn't happen for other cases).
Searching the catalog in the Music.app allows me to play the song. But also gives me the option to add to library (which fails).
I get the unplayable version when I request all the songs in my library using MusicKit (framework), but i get a 404 error if I do the same thing using Apple Music API (web service)
Has someone else run into this issue?
In any case, I reported this behavior here: FB12119624
Post
Replies
Boosts
Views
Activity
For some reason some 200 songs in my iCloud library are unplayable as they lack the play parameter object (it just comes back nil), so I also don't have the catalog id for the song, just the library id. If I had the catalog id, I could just make a CatalogResourceRequest matching the ids...
So I wanted to make a CatalogResourceRequest matching the song title and artistName instead, but as far as I can tell, I can only make a CatalogSearchRequest passing a string with this information, but I can't make a specific resourceRequest matching a song's title.
I just wanted to make sure I'm correct that this is imposible and my best bet is making a CatalogSearchRequest
I'm trying to match the id of the song currently playing with the id of the song I added to the queue, but they never match.
musicPlayer.queue = [mySongVar]
print(mySongVar)
This will print out:
Song(id: "i.eoqMkIkPJ9Ea", title: "À peu près", artistName: "Pomme")
then I tell the musicPlayer to play what's in the queue and print:
print(musicPlayer.queue.currentEntry!.item!.description)
And I´ll get this:
MusicPlayer.Queue.Entry.Item.song(Song(id: "1440887303", title: "À peu près", artistName: "Pomme"))
I don't understand why the Song.id for the Item for the queue's current entry is a a certain string, but the if for my original Song object I sent to the queue is something else entirely.
I'm not sure if I'm going about this the wrong way. I'd really appreciate some help/guidance!
Thanks"
By the way:
let musicPlayer = ApplicationMusicPlayer.shared