title: How to send and read image/video in iOS message extension?
body: <p><strong>My goal:</strong></p>
  
  <ul>
  <li>Allow user to send (or attach) a video clip to a message</li>
  <li>Allow receiver to read (not playing) the video when it is received</li>
  <li>Not using an additional server to host these messages or videos. In other words, I want everything to be done within the message extension framework.</li>
  </ul>
  
  <p><strong>I tried:</strong></p>
  
  <p>1) Using MSMessage:</p>
  
  <pre><code>private func insertVideoIntoMessage(usingUrl url: URL) {
      if let conversation = self.activeConversation {
          let layout = MSMessageTemplateLayout()
  
          layout.caption = "Some caption"
          layout.mediaFileURL = url                // Media file (video)
  
          let message = MSMessage()
          message.layout = layout            
          message.url = URL(string: "some url")
  
          conversation.insert(message, completionHandler: { error in
              if let error = error {
                  print("Error:", error)
              }
          })
      }
  }
  </code></pre>
  
  <p>I would like to let the receiver read the media file (video). However, it doesn't seem to be possible.</p>
  
  <pre><code>override func didSelect(_ message: MSMessage, conversation: MSConversation) { 
      // message doesn't seem to contain any media content 
  }
  </code></pre>
  
  <p>2) Using an attachment:</p>
  
  <pre><code>private func insertVideoInMessage(usingUrl url: URL) {
      if let conversation = self.activeConversation {
          conversation.insertAttachment(url, withAlternateFilename: "Some file name", completionHandler: { error in
              if let error = error {
                  print("Error:", error)
              }
          })
  }
  </code></pre>
  
  <p>This way the attachment (video) is opened by the system's default App. Which means my App couldn't read the video.</p>
  
  <p><strong>Questions:</strong></p>
  
  <ul>
  <li>Is it possible to let receiver read the video sent by sender?</li>
  <li>Is it possible to insert an attachment <strong>AND</strong> insert an MSMessage at the same time?</li>
  <li>Or is there any other way that I could do what I want?</li>
  </ul>