关于ios 和 android 录音(语音)对聊文件格式问题
在做语音对讲的时候,将会碰到录制语音格式的问题,这些需要跨平台我们可能需要使用双方平台都支持的格式,或者执行编码转换
解决方式如下:
wav:文件太大,不建议网络传输
mp3: ios,android录制都 需要进行编码转换,使用lame第三方库,缺点是两边都需要做操作
amr:ios 4.3之前的版本支持,以后版本都不支持amr格式,android设备支持该格式,采用这种格式,ios设备可用libOpenCore第三方库进行转换,播放时再进行解码成原始pcm进行播放。android设备可直接录制与播放
aac:两系统应该都支持的格式,但有说android设备有支持的不够好。没做测试,具体情况未知。 缺点是android对使用aac有限制
最终最合适的解决办法就是 android 使用amr ios使用 libOpenCore第三方库进行转换