IOS 5 No audio when playing a video with Silent mode on with a buzztouch app

前端 未结 3 1502
后悔当初
后悔当初 2021-01-06 06:37

I have done several apps with buzztouch for Iphone and Ipads, here is a free one as an example :

http://itunes.apple.com/us/app/lr-basics-free-edition/id497563707?mt

3条回答
  •  执笔经年
    2021-01-06 06:54

    What you are describing is the default behavior in iOS - when the ring/silent switch is in silent mode all audio from your app will be suppressed.

    I don't know about implementing this from BuzzTouch, but here is a native solution I used to get around this for one of my apps that plays video:

    MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:myVidURL];
    
    ... set up player ...
    
    // prevent mute switch from switching off audio from movie player
    NSError *_error = nil;
    [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &_error];
    
    [self presentMoviePlayerViewControllerAnimated:mpvc];
    

    You will also need to include the AVFoundation framework for this to work.

    Here's the link where I first found this tip:

    http://www.24100.net/2011/05/ignore-ringtone-mute-switch-during-mpmovieplayer-video-playback-ios/

提交回复
热议问题