我的目标:
我试过了:
1)使用MSMessage:
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)
}
})
}
}
我想让接收器读取媒体文件(视频)。但是,它似乎不可能。
override func didSelect(_ message: MSMessage, conversation: MSConversation) {
// message doesn't seem to contain any media content
}
2)使用附件:
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)
}
})
}
这样,附件(视频)由系统的默认应用程序打开。这意味着我的应用无法阅读视频。
问题: