且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AVAudioRecorder不会创建可以打开和播放的.m4a文件

更新时间:2023-08-27 20:45:28

问题1的答案是您必须正确设置音频会话,否则m4a文件的格式不正确.在开始录制之前,我现在设置的音频会话代码是:

The answer to question 1 is that you have to set the audio session correctly, otherwise the m4a file does not get formatted correctly. The audio session code that I now set, just before I start recording is:

AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryRecord error:nil];
[session setActive:YES error:nil];

我将会话设置为在录制完成后进行回放,以便可以播放音频文件.

I set the session back for playback after recording is finished so that audio files can be played back.

问题2是VLC中的一个问题,显示的通道数不正确.音频文件在MacOS Finder的获取信息"窗口中显示为单个通道.

Question 2 is a problem in VLC which was displaying the incorrect number of channels. The audio file, in the MacOS Finder's Get Info window, shows up as single channel.

问题3未得到答案.