10

I am sending video message in iMessage App using following code.

@IBAction func didPress() {
        if let conversation = activeConversation {
            if let filePath = Bundle.main.path(forResource: "small", ofType: ".mp4") {
                let filePathURL = NSURL.fileURL(withPath: filePath)

                let layout = MSMessageTemplateLayout()
                //layout.image = image
                layout.mediaFileURL = filePathURL

                let message = MSMessage()
                message.layout = layout

                //message.url = URL(string: "emptyURL")

                conversation.insert(message, completionHandler: { (error: NSError?) in
                    print(error as Any)

                    } as? (Error?) -> Void)

            }

        }
    }

When It appears in the message window it successfully plays the video with muted sound icon. When I tap the sound icon to open the volume it instead open the expanded View Controller.

Is this the iOS bug in iMessage App Extension?

Video with muted icon

View as a result of tap on muted icon

Idrees Ashraf
  • 1,363
  • 21
  • 38

2 Answers2

0

Is it not because of default layout? MSMessageTemplateLayout()

Have you tried custom layout?

DJ'
  • 1,760
  • 1
  • 13
  • 26
  • MSMessageTemplateLayout can't be customized unfortunately. https://developer.apple.com/documentation/messages/msmessagetemplatelayout As documentation says "Do not subclass the MSMessageTemplateLayout class." – Idrees Ashraf Jul 28 '17 at 12:38
0

According to bug reporter You should use the insertAttachment API to insert MP3, WAV and M4a.

conversation.insertAttachment(fileUrl, withAlternateFilename: "fileAudio") { error in
        if let error = error {
            print(error)
        }
Nikhlesh Bagdiya
  • 4,316
  • 1
  • 19
  • 29