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

前端 未结 3 1501
后悔当初
后悔当初 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:52

    Hint: Upload the audio file to your buzztouch account files. This is the only way Buzztouch will recognize the audio. next, add the audio file to your xcode bttouch sound folder and add all references. You should be fine!

    0 讨论(0)
  • 2021-01-06 06:53

    Right from documentation - iOS has 6 audio session categories out of that 3 affects the behavior of Slient switch:

    AVAudioSessionCategoryAmbient or the equivalent kAudioSessionCategory_AmbientSound— Using this category, your audio is silenced by the Ring/Silent switch and when the screen locks. Used when we want our app audio with built-in app audio

    AVAudioSessionCategorySoloAmbient or the equivalent kAudioSessionCategory_SoloAmbientSound—Use this category for an application whose audio you want silenced when the user switches the Ring/Silent switch to the “silent” position and when the screen locks. This is the default category

    AVAudioSessionCategoryPlayback or the equivalent kAudioSessionCategory_MediaPlayback—Use this category for an application whose audio playback is of primary importance. Your audio plays even with the screen locked and with the Ring/Silent switch set to silent.

    0 讨论(0)
  • 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/

    0 讨论(0)
提交回复
热议问题