I have been excitedly testing out MusicKit's new features to interact with a user's music library over the last couple of days. Albums and Songs are a much nicer paradigm than MPMediaItemCollection and MPMediaItem, but I'm afraid that there are some library-focused metadata options present on MPMediatem that are seemingly not currently exposed on Songs fetched from a MusicLibraryRequest that force me back into the world of MPMediaItems.
A big component of my app is being able to sort and filter your library across properties like play count and date added. Am I right that these properties are not available when interacting with library Songs in MusicKit?
- dateAdded - The date the item was added to the library
- lastPlayTime - The date on which the item was last played
- playCount - The number of times the item has been played
For as long as those properties are not available, I will need to dip back into MPMediaItems in order to continue offering important pieces of functionality in my app.
Those three are my highest priority for this area of MusicKit at this time, and are my biggest blockers on jumping into the new world as opposed to staying the old. I've submitted the above as FB10185523
While I'm at it, I also have a wishlist of some additional properties, only one of which is currently exposed on MPMediaItem. The rest of which correspond to metadata a user can set in Music.app on the desktop but have not historically been publicly exposed on MPMediaItem:
- isCloudItem - This is currently exposed on MPMediaItem and tells you whether an item is locally downloaded on the device. I understand that the includeOnlyDownloadedContent option can be set on a MusicLibraryRequest to return locally downloaded devices, but it would also be nice to have on a per-song basis to be able to display an indicator to the user.
- startTime and stopTime - These properties correspond to the custom “start” and “stop” times a user can define for a song on the Options tab of Music.app on the desktop. These have not historically been exposed publicly. It would be nice to have access to these in order to be able to display an accurate play time if a user has customized it.
- sortAlbumTitle, sortAlbumArtist, sortArtist - These properties correspond to the “sort as” options a user can define for a song on the Sorting tab of Music.app on the desktop. These have not historically been exposed publicly. It would be nice to have access to these in order to display library items to a user in the order they’ve defined and expect, rather than ignore their preference.
I've submitted the above as FB10185575
Thanks!
Hello @talkingsmall and @snuff4,
We made a number of important improvements to the list of available properties for items retrieved from the music library. You can find those in iOS 16 Beta 3, which just we just released today.
For example, the Song type now includes the following attributes:
I hope you'll find this useful.
Best regards,