How do I get the lyrics of the currently playing song in Swift 4?

馋奶兔 提交于 2019-12-13 03:25:36

问题


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.

来源:https://stackoverflow.com/questions/54042020/how-do-i-get-the-lyrics-of-the-currently-playing-song-in-swift-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!