Using remote io for recording and AVPlayer for playing ipod library audio at the same time continuously

谁说胖子不能爱 提交于 2019-12-11 13:32:50

问题


Can I use remote io for recording and AVPlayer for playing iPod library audio at the same time continuously?

I tried but the error returned was:

AURemoteIO::ChangeHardwareFormats: error -10875.

回答1:


As far as I know, officially it is not possible. When you start the recording sessions, except for recording does not occupy it. Once you playback and recording sessions in the session must be solved. recording and playback session, the session can not be occupied simultaneously.

refer a apple documentation: Audio Session

AVAudioSessionCategoryPlayAndRecord or the equivalent kAudioSessionCategory_PlayAndRecord—Use this category for an application that inputs and outputs audio. The input and output need not occur simultaneously, but can if needed. This is the category to use for audio chat applications.




回答2:


Yes it is possible. I suggest downloading this example app: http://zerokidz.com/audiograph/Home.html audioGraph. Then attempting to play an audio file with AVPlayer while the mic is enabled. I found that it is possible, but it depends on the file format of audio you want to play with AVPlayer.

For example, I found that if you have an InputCallback at 44800hz and attempt to play an audiofile with AVPlayer that is 44100hz, you will start receiving errors in the InputCallback. But if you play an 48000hz file, it will work fine.



来源:https://stackoverflow.com/questions/11919464/using-remote-io-for-recording-and-avplayer-for-playing-ipod-library-audio-at-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!