1.設置類別,表示該應用同時支持播放和錄音session
1 OSStatus error; 2 UInt32 sessionCategory = kAudioSessionCategory_PlayAndRecord; 3 error = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, 4 sizeof (sessionCategory), 5 &sessionCategory 6 );
2.經過音頻會話能夠強制的設置應用程序使用指定的輸出方式,例如:內聲道,揚聲器,代碼以下ide
1 UInt32 audioRouteOverride = isNoOpen ?kAudioSessionOverrideAudioRoute_None:kAudioSessionOverrideAudioRoute_Speaker; 2 AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
摘自:http://blog.csdn.net/ysy441088327/article/details/8164120 感謝做者分享spa