开发者

Is it possible to put audio into 'phone' mode?

开发者 https://www.devze.com 2023-01-12 16:01 出处:网络
By this I mean, use the speaker and phone microphone but don\'t use the speaker in the handsfree style.

By this I mean, use the speaker and phone microphone but don't use the speaker in the handsfree style.

So the use case is: 1. User is listening to the app via the phones speaker 2. They wish to put the phone to thei开发者_运维知识库r ear so they choose an option which changes the audio to be as if they were talking on the phone (i.e. non-hands free mode)

Does this make sense? Or should this happen automatically?


You'll want to set the audio session category to AVAudioSessionCategoryPlayAndRecord:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord];

This will route all audio output to the receiver--"the small speaker you hold to your ear when on a phone call". See Audio Session Programming Guide: Configuring the Audio Session for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消