Swift 在使用MPMusicLayerController播放音乐的同时,是否可以使用Airpods麦克风录制音频?
目前,我一直在使用Swift 在使用MPMusicLayerController播放音乐的同时,是否可以使用Airpods麦克风录制音频?,swift,avfoundation,speech-recognition,avaudioengine,mpmusicplayercontroller,Swift,Avfoundation,Speech Recognition,Avaudioengine,Mpmusicplayercontroller,目前,我一直在使用installTap通过Airpods麦克风录制音频。以下是我的AVAudioEngine设置: let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(.playAndRecord, mode: .measurement, options: [.mixWithOthers, .allowBluetooth]) 我还想在播放过程中使用MPMusicPlayerControl
installTap
通过Airpods麦克风录制音频。以下是我的AVAudioEngine设置:
let audioSession = AVAudioSession.sharedInstance()
try audioSession.setCategory(.playAndRecord, mode: .measurement, options: [.mixWithOthers, .allowBluetooth])
我还想在播放过程中使用MPMusicPlayerController.applicationMusicPlayer
通过Airpods播放用户的苹果音乐库,而不中断录制
不幸的是,installTap似乎会阻止音乐播放器,因为每当我尝试播放歌曲时,都会出现以下错误:
Failed to prepareToPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=6 "Failed to prepare to play" UserInfo={NSDebugDescription=Failed to prepare to play}
有办法同时做这两件事吗?我能找到的最接近的相关问题是,但它没有关于MPMusicLayerController的信息