How to record using AVAudioRecorder without the .caf container?

前端 未结 1 1475
栀梦
栀梦 2021-02-10 01:27

I am using a AVAudioRecorder instance to record with the setting for AVFormatIDKey set to kAudioFormatMPEG4AAC. It records the audio in AAC format bu

1条回答
  •  日久生厌
    2021-02-10 02:20

    Found the answer. There is a weird way the AVAudioRecorder works.

    The format in which the AVAudioRecorder will save your file depends on the URL/string you specify for the file you save. It depends on the extension of the file name you are saving.

    If you don't specify any extension or one that the recorder can't understand then it will add the Core Audio container. So, basically see to that the extension and the AVFormatIDKey match. Like for aac use format use .aac extension with kAudioFormatMPEG4AAC as the AVFormatIDKey

    0 讨论(0)
提交回复
热议问题