注册

环信的消息返回,是什么的格式

对于text的返回如下:msg{from:custom, to:qianhua1 body:txt:"hwhwhq"
对于voice的返回如下:
msg{from:custom, to:qianhua1 body:voice:custom20151026T104019.amr,localurl:/storage/emulated/0/Android/data/com.qianhua.bestonn3/owant#owant/qianhua1/voice/ea824f60-7b8a-11e5-b405-750b8ada4597,remoteurl:http://182.92.228.160:80/owant/owant/chatfiles/ea824f60-7b8a-11e5-b405-750b8ada4597,length:6
首先,如何解析出声音?这个是什么格式呀?
 
已邀请:

zhangnan

赞同来自: 欧拉啊旺

语音类型消息{ "from":"test2", "to":"test1", "bodies":[{ "type":"audio",//语音消息类型 "url":"https://a1.easemob.com/easemob-demo/chatdemoui/chatfiles/0637e55a-f606-11e3-ba23-51f25fd1215b",//上传语音远程地址,在上传语音后会返回uuid "filename":"test1.amr",//语音名称 "length":10, //语音时间(单位秒) "secret":"DRGM8OZrEeO1vafuJSo2IjHBeKlIhDp0GCnFu54xOF3M6KLr"//secret在上传文件后会返回 }] }
根据url地址下载语音文件
:voice:custom20151026T104019.amr,localurl:/storage/emulated/0/Android/data/com.qianhua.bestonn3/owant#owant/qianhua1/voice/ea824f60-7b8a-11e5-b405-750b8ada4597,remoteurl:http://182.92.228.160:80/owant/owant/chatfiles/ea824f60-7b8a-11e5-b405-750b8ada4597,length:6


我通过EMMessage的getBody().toSting获得上面的信息,localurl:是说明本地已经有了语音? 
而且通过你们的EMMessage的
getStringAttribute("localurl") 来获得localurl,异常了com.easemob.exceptions.EaseMobException: attribute localurl not found,说没有找到
这个是要下载,本地才会有,message会有本地和远程的url地址,你是客户端获取url吗,参考下环信demo的代码看下,已经实现了

要回复问题请先登录注册