0

I am developing a chat app using parse. I want to play the vodeo when users click on the video message and Display expandable image when the user click on the picture message. for that I need to differentiate image and video. Kindly guide me to do that...

Ragul
  • 3,176
  • 3
  • 16
  • 32
  • I'm not into Parse... How do you receive the image and video data? NSData? Maybe this could help http://stackoverflow.com/a/31243940/2798777 – matthias Jul 23 '15 at 09:07
  • When user sends something, you can tag the data to describe what it is, when receiving data you can then know what kind of data it is. Or it is another problem? Question not really clear. – Jean-Baptiste Yunès Nov 20 '15 at 20:45

3 Answers3

0

Surely the easiest way will be of course to look at the file extension...?

xamiax
  • 291
  • 1
  • 2
  • 8
0

For future googlers ... on didTapMessageBubbleAtIndexPath delegate you should check for item class

let message = yourMessageArray[indexPath.item]

if message.isMediaMessage() {
    if message.media().isKindOfClass(JSQPhotoMediaItem) {
         //Handle image
    } else if message.media().isKindOfClass(JSQVideoMediaItem) {
         let video = message.media() as! JSQVideoMediaItem
         let videoURL = video.fileURL
    }
}
Steve
  • 959
  • 1
  • 11
  • 23
  • its not allowing `JSQPhotoMediaItem `. Because its in pod file.How to do this.Just while clicking Video message i need to play video,... –  May 12 '16 at 10:57
  • If your message is kind of class JSQVideoMediaItem you can get url as above and play it – Steve May 13 '16 at 21:21
0

Save this information in another field on Parse during the asset upload.