AVAudioSession 音频会话

https://www.jianshu.com/p/3e0a399380df 
 http://blog.csdn.net/kingshuo7/article/details/42588191 这里面总结的不错
https://segmentfault.com/a/1190000002401961 修改系统音量,ios9好像没用
http://blog.csdn.net/sunljdeng/article/details/49152597
http://blog.csdn.net/kingshuo7 iphone的microphone speaker硬件调用
https://developer.apple.com/library/content/qa/qa1799/_index.html 参考苹果文档
http://blog.csdn.net/u010795305/article/details/50979099
http://blog.csdn.net/lixing333/article/details/43154541



https://support.apple.com/en-us/HT203792 iphone麦克风位置


//边录边播   会导致使用了听筒播放  按照官方文档的说法通过重写audio route属性来重定向音频。
1.[[AVAudioSession sharedInstance]setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
2.[[AVAudioSession sharedInstance] overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];//1-2两句效果相等

[[AVAudioSession sharedInstance]setActive:YES error:nil];//马上设置

[[AVAudioSession sharedInstance]setActive:NO error:nil];//交出音频会话

每次的麦克风转换都是硬件调用,会有一定几毫秒延时,所以录影录或音后设定延时等待释放后才转换,不然换了也没用


原文地址:https://www.cnblogs.com/yeng/p/6019507.html