ShravanKumar Teegala
ShravanKumar Teegala

Reputation: 31

How to send image (image url),video chat App Messages using XMPPFramework iOS

I'm sending only text, but I don't know how to send image/url, videos and integrate that in the chat application in iOS using XMPP.

Please help me.

Upvotes: 2

Views: 1448

Answers (1)

Uscher
Uscher

Reputation: 81

Please note that you should

  • Provide what you have done so far.
  • Search for answers first.

Please check existing answers

There are two basic approaches to send media data

  • inband (message with attachment - refer to existing answers)
  • out-of-band (upload media file to server and send URL in message)

Sending inband data should only be used for small media data. I recommend to use the out-of-band approach.

Out-of-band solutions supported by XMPPFramework

You are the most flexible when you use your own extension, but a standard XMPP client will not understand this. If you implement your own clients the I recommend this approach as follows.

Send media message

  1. Upload media file to server.
  2. Send message with content attribute and out

Receive media message

  1. Parse message received and detect content type and out-of-band file name
  2. Download media file from server.
  3. Delete media file from server.

Example for your own XMPP message extension

<message from=... to=... id=... type=chat>
  <body></body>
  <myapp xmlns=mycompany:myapp content=image>
    <out_of_band_file>myuniquefilename.jpg</out_of_band_file>
  </myapp>
</message>

This way you may define your own content types like image, video, audio.

Upvotes: 3

Related Questions