zohar zohar - 1 year ago 126
iOS Question

How to make MPMoviePlayerController ignore the mute switch

I want to play a video using

but I want it to ignore the mute switch, similar to the behavior of Youtube's video player.

Any ideas?

Answer Source

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 frameworks
NSError *error = nil;
BOOL success = [[AVAudioSession sharedInstance] 
if (!success) {
    // Handle error here, as appropriate
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download