How to set current playback duration and elapsed time on iOS 7 lockscreen?

前端 未结 3 1305
抹茶落季
抹茶落季 2020-12-08 05:25

Starting from iOS 5, every music player can set current playing music information such as title, artist, album title, and artwork on [MPNowPlayingInfoCenter defaultCenter].n

3条回答
  •  死守一世寂寞
    2020-12-08 05:45

    Just be warned: Apple's document never made this clear -- If you use MPMusicPlayerController, your music is played under the hood by the "music" app and you do NOT have any control of nowPlayingInfoCenter. And you will NOT receive remote control events generated by the user actions (such as play/pause) applied to the lock screen because those events are propagated via the nowPlayingInfoCenter to the "music" app, not to yours. When using other media players, such as AV or AvAudio, you can control the nowPlayingInfoCenter and receive the remote control events. But if you use AVAudioSessionCategoryOptions.MixWithOthers to set up the AV player, you can't control nowPlayingInfoCenter either. I wish Apple documented those details better.

提交回复
热议问题