RCVoiceMessage Class Reference
Inherits from | RCMessageContent : NSObject |
---|---|
Conforms to | NSCoding |
Declared in | RCVoiceMessage.h |
wav格式的音频数据
wavAudioData
wav格式的音频数据
@property (nonatomic, strong) NSData *wavAudioData
Discussion
wav格式的音频数据
Declared In
RCVoiceMessage.h
语音消息的时长
duration
语音消息的时长
@property (nonatomic, assign) long duration
Discussion
语音消息的时长
Declared In
RCVoiceMessage.h
语音消息的附加信息
extra
语音消息的附加信息
@property (nonatomic, copy) NSString *extra
Discussion
语音消息的附加信息
Declared In
RCVoiceMessage.h
初始化语音消息
+ messageWithAudio:duration:
初始化语音消息
+ (instancetype)messageWithAudio:(NSData *)audioData duration:(long)duration
Parameters
audioData |
wav格式的音频数据 |
---|---|
duration |
语音消息的时长(单位:秒) |
Return Value
语音消息对象
@discussion 如果您不是使用IMKit中的录音功能,则在初始化语音消息的时候,需要确保以下几点。 1. audioData必须是单声道的wav格式音频数据; 2. audioData的采样率必须是8000Hz,采样位数(精度)必须为16位。
您可以参考IMKit中的录音参数: NSDictionary *settings = @{AVFormatIDKey: @(kAudioFormatLinearPCM), AVSampleRateKey: @8000.00f, AVNumberOfChannelsKey: @1, AVLinearPCMBitDepthKey: @16, AVLinearPCMIsNonInterleaved: @NO, AVLinearPCMIsFloatKey: @NO, AVLinearPCMIsBigEndianKey: @NO};
Discussion
初始化语音消息
Declared In
RCVoiceMessage.h