How to make MPMoviePlayerController ignore the mute switch
Use the AVAudioSession
category AVAudioSessionCategoryPlayback
and your app will ignore the mute switch like the Youtube app.
For example (inspired by Ken Pletzer in the comments):
#import <AVFoundation/AVFoundation.h>// note: you also need to add AVfoundation.framework to your project's // list of linked frameworksNSError *error = nil;BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error];if (!success) { // Handle error here, as appropriate}
in Swift: Do this once before you play sound/video (for example at the beginning of your application)
do{ try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)} catch { //Didn't work}