Cross reference content with the Apple Music API

RSS for tag

Discuss the WWDC21 session Cross reference content with the Apple Music API.

Posts under wwdc21-10293 tag

6 Posts

Post

Replies

Boosts

Views

Activity

Music preview with MusicKit
Hi, I apologize for asking so many questions. I don't know that I'll ever ship anything but I'm experimenting with an old fashioned radio station like we used to program in the old top forties days. I'd like to allow the music programmers to listen to sets that they're building by skimming through songs - does MusicKit or any part of the API allow us to access the Music preview for a given song? i.e. - I want users with a subscription to be able to hear the 30 s preview that you can find in Music. I may be requesting that a Song have a preview as one of its playing mode options. Thank you, Daniel
9
0
4.6k
Apr ’22
Any way to check if song is in Library with MusicKit? ?relate=library not working for me
For my app that heavily uses both ShazamKit and MusicKit, I need to be able to check if the matched song is in the user's library or not. I couldn't find an easy way to do this with MusicKit so I first then turned to the Apple Music API as they introduced the new parameter ?relate=library during this year's WWDC. When I first tried it, it worked as expected, and was very happy to have gotten it to work. However, it stopped working lately and now I turned to use MPMediaLibrary as that still works but is a lot slower in performance. Anyone has any idea why the ?relate=library stopped working for me or know a better way to check if the Song exists in the user's library? func checkInLibrary(from appleMusicID: String) async { do { let countryCode = try await MusicDataRequest.currentCountryCode let libURL = URL(string: "https://api.music.apple.com/v1/catalog/\(countryCode)/songs/\(appleMusicID)?relate=library")! let request = MusicDataRequest(urlRequest: URLRequest(url: libURL)) let dataResponse = try await request.response() print(dataResponse.debugDescription)               } catch { // I'm handling errors here }}
6
0
3.2k
Feb ’22
How to fetch next batch of albums for an Artist?
Hello, I am fetching and displaying the .fullalbums for an Artist through the MusicKit api. The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch. Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
2
0
1.3k
Aug ’21
How to play Music Videos with MusicKit for Swift?
Hello, I am wondering how one can play music videos (with the actual video playing) with the ApplicationMusicPlayer using MusicKit for Swift? There is not much documentation on this, so any help would be appreciated.
Replies
6
Boosts
0
Views
3.1k
Activity
Jan ’26
How to get resources for a Genre?
I am trying to display albums, playlists and artist for a Genre. Does anyone know how to do this or if this is not currently supported by the MusicKit and Apple Music API?
Replies
4
Boosts
0
Views
2.1k
Activity
Jun ’22
Music preview with MusicKit
Hi, I apologize for asking so many questions. I don't know that I'll ever ship anything but I'm experimenting with an old fashioned radio station like we used to program in the old top forties days. I'd like to allow the music programmers to listen to sets that they're building by skimming through songs - does MusicKit or any part of the API allow us to access the Music preview for a given song? i.e. - I want users with a subscription to be able to hear the 30 s preview that you can find in Music. I may be requesting that a Song have a preview as one of its playing mode options. Thank you, Daniel
Replies
9
Boosts
0
Views
4.6k
Activity
Apr ’22
Any way to check if song is in Library with MusicKit? ?relate=library not working for me
For my app that heavily uses both ShazamKit and MusicKit, I need to be able to check if the matched song is in the user's library or not. I couldn't find an easy way to do this with MusicKit so I first then turned to the Apple Music API as they introduced the new parameter ?relate=library during this year's WWDC. When I first tried it, it worked as expected, and was very happy to have gotten it to work. However, it stopped working lately and now I turned to use MPMediaLibrary as that still works but is a lot slower in performance. Anyone has any idea why the ?relate=library stopped working for me or know a better way to check if the Song exists in the user's library? func checkInLibrary(from appleMusicID: String) async { do { let countryCode = try await MusicDataRequest.currentCountryCode let libURL = URL(string: "https://api.music.apple.com/v1/catalog/\(countryCode)/songs/\(appleMusicID)?relate=library")! let request = MusicDataRequest(urlRequest: URLRequest(url: libURL)) let dataResponse = try await request.response() print(dataResponse.debugDescription)               } catch { // I'm handling errors here }}
Replies
6
Boosts
0
Views
3.2k
Activity
Feb ’22
How to fetch next batch of albums for an Artist?
Hello, I am fetching and displaying the .fullalbums for an Artist through the MusicKit api. The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch. Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
Replies
2
Boosts
0
Views
1.3k
Activity
Aug ’21
Can you get an Album from a Song with MusicKit?
Is it possible to get an album from a song in MusicKit? I haven't been able to find a way to do so currently. I have tried using .with() but it appears that album is not supported. What I am looking for is properties on the Song like what is present on MPMediaItem such as albumTitle, genre, etc.
Replies
3
Boosts
0
Views
1.3k
Activity
Jul ’21