0
votes

I am getting the Current Song playing as an MPMediaItem and I can successfully retrieve the title, artist and song length. However when I try to get the lyrics nothing shows up in the text field that I am updating.

let currentSong: MPMediaItem = mediaItemCollection.items[0]

if let artwork: MPMediaItemArtwork = currentSong.value(forProperty: MPMediaItemPropertyArtwork) as? MPMediaItemArtwork {
    albumArtwork.image = artwork.image(at: CGSize(width: 120, height: 120))
    songTitle.text = currentSong.title
    songArtist.text = currentSong.artist
    songLength.text = currentSong.playbackDuration.stringFromTimeInterval()
    songLyrics.text = currentSong.lyrics

}

I want songLyrics.text to be equal to the lyrics of the song.

Are you sure that your song has the lyrics embedded in its metadata? It doesn't have to, that's why most of MPMediaItem properties are optionals.mag_zbc
Do you know how to check if they have values or not?Jack_Lynch
did you get any solution to this?Yogesh Patel
@YogeshPatel Unfortuantely I pinned the project back then, however since then I've gained more programming experience, I would recommend just checking its type/value to see if it's null or length == 0. (Something along those lines)Jack_Lynch