你好,请把Android的log及iOS的log都发过来,谢谢。

Android发送消息的代码,iOS接收消息的代码也请贴出来。

android 发送消息 public void sendAudio(String audioPath) {
try {
AVIMAudioMessage audioMsg = new AVIMAudioMessage(audioPath);
sendMsg(audioMsg, audioPath, sendCallback);
} catch (IOException e) {
LogUtils.logException(e);
}
}

private void sendMsg(final AVIMTypedMessage msg, final String originPath, final SendCallback callback) {
if (!chatManager.isConnect()) {
LogUtils.i("im not connect");
}
//发送消息的回调

conversation.sendMessage(msg, AVIMConversation.RECEIPT_MESSAGE_FLAG, new AVIMConversationCallback() {
  @Override
  public void done(AVIMException e) {    	  
    if (e == null && originPath != null) {
      File tmpFile = new File(originPath);
      File newFile = new File(PathUtils.getChatFilePath(msg.getMessageId()));
      boolean result = tmpFile.renameTo(newFile);
      if (!result) {
        LogUtils.i("move file failed, can't use local cache");
      }
    }
    if (callback != null) {
      if (e != null) {
        callback.onError(msg, e);
      } else {
     callback.onSuccess(msg);

}
}

录音的代码 用的是MediaRecorder
private void startRecording() {
try {
if (recorder == null) {
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
recorder.setOutputFile(outputPath);
recorder.prepare();
} else {
recorder.reset();
recorder.setOutputFile(outputPath);
}
recorder.start();
thread = new ObtainDecibelThread();
thread.start();
recordEventListener.onStartRecord();
} catch (IOException e) {
e.printStackTrace();
}
}

非Leancloud工程师

建议你检查下你的android的录音的编码,统一个比较合理的,ios的不是兼容所有的编码

录音的编码用的是 mediaRecorder 编码应该是amr 的吧,统一用哪个? 以前的录音播放不是可以?

mediaRecoder的默认编码格式不是amr的,是THREE_GPP。 是否因为你的ios使用amr打开,导致无法播放?