加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift – AVAudioSession:麦克风耳机作为输入,iphone扬声器作为

发布时间:2020-12-14 04:31:41 所属栏目:百科 来源:网络整理
导读:使用iOS10,管理AUdioSession的可能性更大,但是当音频通过 iphone扬声器输出时,我无法将耳机麦克风作为输入. 下面的’overrideOutputAudioPort’方法也会将输入音频端口覆盖为iphone麦克风 let session = AVAudioSession.sharedInstance()do { try session.se
使用iOS10,管理AUdioSession的可能性更大,但是当音频通过 iphone扬声器输出时,我无法将耳机麦克风作为输入.

下面的’overrideOutputAudioPort’方法也会将输入音频端口覆盖为iphone麦克风

let session = AVAudioSession.sharedInstance()
do {
  try session.setCategory(AVAudioSessionCategoryPlayAndRecord)
  try! session.overrideOutputAudioPort(.speaker)  
} catch {
}

是否有任何解决方案可以保持耳机输入?

解决方法

我如何解析 this Apple documentation,使用AVAudioSession是不可能的:

If a headset is plugged in at the time you set this property’s value to kAudioSessionOverrideAudioRoute_Speaker,the system changes the audio routing for input as well as for output: input comes from the built-in microphone; output goes to the built-in speaker.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读