关于iOS录音后播放声音小的问题

设置AVAudioSession为以下设置


- (void)configureAVAudioSession
{
   // Get your app's audioSession singleton object
    AVAudioSession *session = [AVAudioSession sharedInstance];


    // Error handling
    BOOL success;
    NSError *error;


    // set the audioSession category. 
    // Needs to be Record or PlayAndRecord to use audioRouteOverride:  


    success = [session setCategory:AVAudioSessionCategoryPlayAndRecord
                             error:&error];


   if (!success) {
       NSLog(@"AVAudioSession error setting category:%@",error);
   }


    // Set the audioSession override
    success = [session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker
                                          error:&error];
    if (!success) {
        NSLog(@"AVAudioSession error overrideOutputAudioPort:%@",error);
    }


    // Activate the audio session
    success = [session setActive:YES error:&error];
    if (!success) {
        NSLog(@"AVAudioSession error activating: %@",error);
    }
    else {
         NSLog(@"AudioSession active");
    }


}
参考:http://stackoverflow.com/questions/18807157/how-do-i-route-audio-to-speaker-without-using-audiosessionsetproperty

你可能感兴趣的:(iOS)