2

I've found that there are basically to way to add a video into an MSConversation.

  1. Create an MSMessage instance and add the file URL as the mediaFileURL property from the MSMessageTemplateLayout

    let layout = MSMessageTemplateLayout()
    layout.imageTitle = caption
    layout.mediaFileURL = media
    layout.caption = nil
    layout.subcaption = nil
    layout.imageSubtitle = nil
    layout.subcaption = nil
    layout.trailingSubcaption = nil
    let message = MSMessage(session: session ?? MSSession())
    message.layout = layout
    
  2. Add it as an attachment using the method insertAttachment(_:withAlternateFilename:completionHandler:)

The first one creates a preview of the video with the symbol of the message application and it starts automatically to play but with no sound, at the top left you can see a small icon of a speaker.
It doesn't seems to be a way to play the audio, because right after I click on the message it opens the Appstore or the same message application in expanded mode. Sendvideo as message

The latter sends correctly the video but it doesn't start automatically it is required for the user to press the play button over it.

Is there any way to make the video play with audio in the first case? or the only way is to open a specific view controller that plays the video once selected?

Andrea
  • 26,120
  • 10
  • 85
  • 131

1 Answers1

0

I got solution:-

self.activeConversation?.insertAttachment(videoURL, withAlternateFilename: "fileName", completionHandler: { (errir) in

 })
Mitul Marsoniya
  • 5,272
  • 4
  • 33
  • 57
  • Is not the solution to my issue, because in the first mentioned case if you send the attachment there is also a link to your app on the App Store, this is really good to have better engagement with your user. In your case you are simply adding it as a video attachment but you lose this kind of link. – Andrea Apr 29 '19 at 05:36