[](https://travis-ci.org/Colin Humber/HUMAudioRecorder)
要运行示例项目,先克隆仓库,然后首先从 Example 目录运行 pod install
HUMAudioRecorder 通过 CocoaPods 提供。要安装
它,只需将以下行添加到您的 Podfile 中
pod "HUMAudioRecorder"
或者,如果您正在使用 Carthage,只需将 HUMAudioRecorder 添加到您的 Cartfile
github "colinhumber/HUMAudioRecorder"
使用 HUMAudioRecorder 非常简单!只需创建一个文件所在的 URL,设置音频会话设置,并创建一个新的 HUMAudioRecorder 实例。
有关 AVFoundation 设置的列表,请点击此处。
NSURL *url = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.m4a", [NSUUID UUID].UUIDString]]];
NSDictionary *settings = @{ AVFormatIDKey : @(kAudioFormatMPEG4AAC),
AVSampleRateKey : @44100,
AVNumberOfChannelsKey : @1,
AVEncoderAudioQualityKey : @(AVAudioQualityHigh)};
HUMAudioRecorder *audioRecorder = [[HUMAudioRecorder alloc] initWithURL:url settings:settings];
头文件有良好的文档,因此请查看它以获取属性和方法列表。使用该模块作为 UI 中的后备记录器/播放器时,可以使用定义良好的状态。
Colin Humber, [email protected]
HUMAudioRecorder 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。