Playlist 1: created by myself, id: pl.u-BNA6rpjIRXy7Dj
https://music.apple.com/cn/playlist/i-jump-you-jump/pl.u-BNA6rpjIRXy7Dj
Playlist 2: created by Apple Music, id:pl.e1bd354664a743d1ad3e10db21118dc7
https://music.apple.com/cn/playlist/jumping-rope/pl.e1bd354664a743d1ad3e10db21118dc7
When I play list 1:
Failed to play with error: Error Domain=MPMusicPlayerControllerErrorDomain Code=1 "Queue descriptor was not provided." UserInfo={NSDebugDescription=Queue descriptor was not provided.}.
It works well on iOS 15, but has this error on iOS 16 beta6 and beta7. The list2 works well both on iOS 15 and iOS 16
let tracks = try await loadTracks("pl.u-BNA6rpjIRXy7Dj") // not works, pl.e1bd354664a743d1ad3e10db21118dc7 this id works
ApplicationMusicPlayer.shared.queue = ApplicationMusicPlayer.Queue(for: tracks)
Task {
do {
try await ApplicationMusicPlayer.shared.play()
} catch {
print("Failed to play with error: \(error).")
}
}
func loadTracks(plId:String) async throws -> MusicItemCollection<Track> {
let playlistRequest = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: MusicItemID(rawValue: plId))
let playlistResponse = try await playlistRequest.response()
if let playlist = playlistResponse.items.first {
let detailedPlaylist = try await playlist.with([.tracks])
let tmpTracks = detailedPlaylist.tracks ?? []
return tmpTracks
} else {
print("Couldn't find playlist.")
return []
}
}
FB: FB11426046