I'm using AVPlayer to play video. And follow these steps
Then the Music app plays, but my video goes blank. From reading Responding to Interruptions
An audio interruption is the deactivation of your app’s audio session—which immediately stops or pauses your audio, depending on which technology you are using
I understand that my video should pause, but why does it also blank the video?
Only after I press the middle button on the headphone again to pause the Music, then my video goes normal again, but remains in paused state
Is this normal behaviour, how to prevent this?
After trying to disable Music app MPNowPlayingInfoCenter
, I found
Just call these before playback
[[AVAudioSession sharedInstance] setActive:YES error:nil];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
This will disable Music app, and toggling middle button on the headphone has no effect on us