5

I was able to embed a video into an MSMessage instance and send it only problem is the audio is automatically muted. You can see that its muted by a little speaker crossed out on the top right of the message bubble. I've also tried it on my iphone without silence, still no sound.

let message = MSMessage()

        let layout = MSMessageTemplateLayout()
        layout.caption = "Titans music video"

        let filePath =
            Bundle.main.path(forResource: "TitansVideo", ofType: "mov")


        let fileUrl = NSURL(fileURLWithPath: filePath!)
        let URL = fileUrl as URL
        layout.mediaFileURL = URL

        message.layout = layout


        let conversation = self.activeConversation

        conversation?.insert(message, completionHandler: {(error) in
            if let error = error {
                print(error)
            }
        })

I've tried using different video files to no avail. I can't find much information on this and i'm beginning to think Apple doesn't want the audio to be enabled. Which is weird since in the ios 10 WWDC you can similarly send youtube videos in iMessage that play Audio/Video in the message bubble.

user3296487
  • 226
  • 2
  • 11
  • I'm having a similar issue but when attaching m4a files. One interesting I saw was that when you send from an iOS 10 device to an iOS 9 device it IS sending the m4a file, but when you send to an iOS 10 device it doesnt seem to show the file and when you tap on the message it just opens the app drawer instead of playing the file. I opened a Radar in August and it was marked as a duplicate of 27308860 which is still marked 'Open' as of Nov 1st. – naomimichiko Nov 01 '16 at 17:59
  • Additionally, try using insertAttachment: instead of insert:(message:completionHandler:). If you're not using anything else in the Layout object you can just skip that step and insert the video directly. – naomimichiko Nov 01 '16 at 18:01

0 Answers0