I'm trying to get the album title from the current entry in the Queue
of ApplicationMusicPlayer
.
I'm using the following code for this purpose -
let queue = ApplicationMusicPlayer.shared.queue
let item = queue.currentEntry?.item
if case let .song(song) = item {
print(song.albumTitle)
}
But it is returning a nil value. If I print the debug description of the song, I get the other details.
Song(
id: "1524813873",
title: "'Til We Die",
artistName: "Slipknot",
discNumber: 1,
hasLyrics: "false",
releaseDate: "2008-08-20",
trackNumber: 15
)
If I do a request to MusicCatalogResourceRequest<Song>
, and print the debug description, I get the album title as well.
let queue = ApplicationMusicPlayer.shared.queue
let item = queue.currentEntry?.item
if case let .song(song) = item {
do {
let musicRequest = MusicCatalogResourceRequest<Song>(matching: \.id, equalTo: song.id)
let response = try await musicRequest.response()
print(response.items.first.debugDescription)
} catch {
print(error)
}
}
Song(
id: "1524813873",
title: "'Til We Die",
albumTitle: "All Hope Is Gone (Deluxe Edition)",
artistName: "Slipknot",
composerName: Chris Fehn, Corey Taylor, Craig Jones, Jim Root, Joey Jordison, Mick Thomson, Paul Gray, Shawn "Clown" Crahan & Sid Wilson,
discNumber: 1,
duration: 345.693,
genreNames: [
"Metal",
"Music",
"Rock"
],
hasLyrics: "true",
isrc: "NLA320887352",
releaseDate: "2008-08-20",
trackNumber: 15
)
Is this a bug or intentional? Thanks!