In my app, I play music and write to the MPNowPlayingInfoCenter.
One of my views has an AVPlayer that shows a muted video on a loop. When this AVPlayer is visible, it overwrites the Info Center’s playback state and says that my app is playing audio, even when my app’s music is paused and the MPNowPlayingInfoCenter MPNowPlayingInfoPropertyPlaybackRate is set to zero.
I have no problem with the info itself (title and artwork remain the same which is good),
it’s just the playback status that shows “playing” when the player is in view.
How can I prevent the AVPlayer from telling the system that audio is playing?
“Now Playing” shows audio is playing, but it’s just a muted video!
I’ve tried using an AVPlayerViewController with playerViewController.updatesNowPlayingInfoCenter = false
, but the lock screen still shows that something is playing.
I’ve tried an AVPlayerLayer as well but the same thing happens. Setting avPlayer.isMuted = false
also does nothing.
I’ve tried updating MPNowPlayingInfoPropertyPlaybackRate on a loop, but the AVPlayer still overwrites it.
I can’t change my app’s AVAudioSession category or mode since I actually am trying to play music separate from the problematic AVPlayer.
Any help is appreciated. Also the goal is to play a m3u8 video url, so if there’s a different way to do that please let me know.