I am attempting to play the sound from a video while the iphone screen is locked. Can I keep the MPMoviePlayerController from being dismissed by a lock screen press? If not I plan to subclass a MPMoviePlayerController and prevent it from being dismissed by a lock button press, which method will allow me to do this?
After toying with a thousand other things I found what I needed to do.
All I needed to do was make two adjustments:
Add this to the AppDelegate.m in the application: didFinishLaunchingWithOptions:
method:
NSError *error = nil;
BOOL success = [[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryPlayback
error: &error];
if (success == false) { /* handle error */ }
Add the following to your info.plist after you drag it into a text editor like Sublime:
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
If you setup your video correctly you will be able to listen to the audio from the video while using other apps and while the screen is in sleep mode.