Reputation: 3842
here is my problem:
I've got an app playing audio files, updating the lockscreen info via MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo
, and this part is working fine.
But in an other view, i'm playing a video with AVPlayerViewController
and AVPlayer
, and when the video starts playing, it's updating the lock screen automatically, with nothing except the video duration.
I didn't find anything about this behaviour in Apple's documentation, I can't find a way to disable it.
So far, I've tried calling UIApplication.sharedApplication().endReceivingRemoteControlEvents()
before the video starts playing, and beginReceivingRemoteControlEvents()
after. It doesn't work.
Does anyone know a way to prevent this?
Upvotes: 3
Views: 1882
Reputation: 4248
Starting with iOS 10 there is a BOOL
property in AVPlayerViewController
called updatesNowPlayingInfoCenter
, that has the default value: YES
. Just change it to NO
:
//playerController is an instance of AVPlayerViewController
if ([self.playerController respondsToSelector:@selector(setUpdatesNowPlayingInfoCenter:)])
{
self.playerController.updatesNowPlayingInfoCenter = NO;
}
Upvotes: 6