AVAudioSession* session = [AVAudioSession sharedInstance];
BOOL success;
NSError* error;
success = [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
if (error)
NSLog(@"AVAudioSession error setting category:%@",error);
success = [session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
if(error)
NSLog(@" AVAudioSession error changing route:%@",error);
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
[audioSession setActive:YES error:nil];
This will also let you use headphones when plugged in.
You received this message because you are subscribed to a topic in the Google Groups "discuss-webrtc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/discuss-webrtc/MWaKZahH1i8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to discuss-webrt...@googlegroups.com.
AVAudioSession* session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayAndRecord error: &error];
// [session setCategory:AVAudioSessionCategoryPlayback error: &error];
[session setActive:TRUE error:&error];
it works for me. i have test on iphone5 and iphone5s
but there are errors in console. details as follow:
2015-01-31 10:36:09.613 rtc.iPhone[4583:b917] 10:36:09.613 ERROR: [0x994d000] AVAudioSessionUtilities.h:88: GetProperty_DefaultToZero: AudioSessionGetProperty ('tlic') failed with error: 'tac!'