MPMusicPlayerController非常慢(滞后1秒以上)

时间:2018-03-05 08:58:03

标签: swift mpmusicplayercontroller mpmediaitem

我正在尝试创建一个音乐播放器,当我在那里添加播放器时,我的应用程序真的很慢......

我无法在5秒内切换多首歌曲,或者我的应用会冻结

let myCollection = MPMediaItemCollection(items: mySongs)
myController.setQueue(with: myCollection)

//setting the album artwork, title, artist and genre... it is way faster when i take it out of the array that I made. when i pluck it from the music player, it is very slow
let mySong = myController.nowPlayingItem


    songTitle.text = mySong?.title
    artistName.text = mySong?.artist
    genreTitle.text = mySong?.genre
    albumArt.image = mySong?.artwork?.image(at: size)


//Skipping stuff when i choose to skip a song.... This is embedded within a gesture... I don't know if thats whats making it slow but it has about a 1 second lag
myController.skipToNextItem()

0 个答案:

没有答案