是否可以使用Airpods麦克风录制音频,同时使用MPMusicPlayerController流式传输音乐?

问题描述

目前,我一直在使用var shdata = document.getElementById('details').value; 通过AirPods麦克风录制音频。这是我的AVAudioEngine设置:

installTap

在发生这种情况时,我还想使用let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory(.playAndRecord,mode: .measurement,options: [.mixWithOthers,.allowBluetooth]) 通过AirPods播放用户的Apple音乐库,而不会中断录制。

不幸的是,installTap似乎阻塞了音乐播放器,因为每次播放歌曲时都会出现以下错误

MPMusicPlayerController.applicationMusicPlayer

有没有办法同时做这两件事?我能找到的最接近的相关问题是iPhone record audio from mic while playing music from iPod library using MPMusicPlayerController,但没有有关Failed to preparetoPlay error: Error Domain=MPMusicPlayerControllerErrorDomain Code=6 "Failed to prepare to play" UserInfo={NSDebugDescription=Failed to prepare to play} 的信息。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)