开发者

record and play the same file

I am trying to record the audio using AVAudioRecorder. My problem is i want to play the file while it is being recorded. Is there any way i can do this? I have set the category to PlayAndRecord. I have created the file for recording.

I have tried to init开发者_如何学Cialize both the recorder and the player for the URL and tried to play the file after the record function. But it seems that only one chunk of the file gets played.


I seriously doubt you can do this with AVAudioRecorder and AVAudioPlayer convenience classes.

The AVAudioPlayer assumes that the file it plays is static and complete. For example, it has no method to dynamically update the track length. It reads the track length once at startup and that is why only the initial chunk of the file gets played. Any modifications to the file made after the AVAudioPlayer instances opens the file are ignored.

You'll need to set up a custom audio queue if you want to get fancy.

As an aside, how do you plan on getting around feedback problem of caused by recording what you are playing? You have nothing but a shrieking squeal in very short order.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜