Change lock screen background audio controls text?

前端 未结 2 938
甜味超标
甜味超标 2020-12-24 06:51

I have an iOS app that streams background audio using AVAudioSession. It is working correctly, but I am curious, is there any way to change the text on the lock screen audio

2条回答
  •  庸人自扰
    2020-12-24 07:20

    here it is in swift! (no need to check for iOS 5 and up anymore)

        let albumArt = MPMediaItemArtwork(image: UIImage(named:"HitchHikersGuide"))
        let albumDict = [MPMediaItemPropertyTitle: "Life, the Universe and Everything", MPMediaItemPropertyPlaybackDuration: 42, MPMediaItemPropertyArtwork: albumArt]
        MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo = albumDict
    

提交回复
热议问题