How to send media content in chat application?

2019-06-13 02:58发布

I am designing a Android chat application using ejabberd as XMPP server and Smack 4.1 API.

My requirement is to send inline images, maps and videos in chat windows. I realized that, sending media content through XMPP Server(ejabberd) is not a good idea when it comes to performance.

I need experts suggestions on how should i proceed with sending inline media content in chat window?

Thanks in advance.

1条回答
干净又极端
2楼-- · 2019-06-13 03:44

Create api that will upload the media data (http post call) using multipart service. on the responce of the service get the url (get http service) and send the url as xmpp message.

<message
    from='user1@hostName'
    id='richard2-4.1.247'
    to='user2@hostName'>
  <body>Sent a Image</body>
  <url>media url</url>
  <thumb> Base 64 </thumb>
</message>

when user2 receive the message you can call service to get the media data

Let me know if you face any issue : cvofjaspreet@gmail.com

查看更多
登录 后发表回答