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

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

概述使用iOS10,管理AUdioSession的可能性更大,但是当音频通过 iphone扬声器输出时,我无法将耳机麦克风作为输入. 下面的’overrideOutputAudioPort’方法也会将输入音频端口覆盖为iphone麦克风 let session = AVAudioSession.sharedInstance()do { try session.setCategory(AVAudi 使用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.

总结

以上是内存溢出为你收集整理的swift – AVAudioSession:麦克风耳机作为输入,iphone扬声器作为输出全部内容,希望文章能够帮你解决swift – AVAudioSession:麦克风耳机作为输入,iphone扬声器作为输出所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1003192.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存