Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 在使用MPMusicLayerController播放音乐的同时,是否可以使用Airpods麦克风录制音频?_Swift_Avfoundation_Speech Recognition_Avaudioengine_Mpmusicplayercontroller - Fatal编程技术网

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的信息