大家好,我尝试构建一个 iMessage 应用程序。我想发送视频。此视频来自 Http 服务器....
import UIKit
import Messages
class MessagesViewController: MSMessagesAppViewController {
@IBAction func bt3(_ sender: UIButton) {
//VIDEO URL
let videoUrl = URL(string: "https://---/app/test/test.m4v")
let message = MSMessage()
message.shouldExpire = false
let layout = MSMessageTemplateLayout()
layout.mediaFileURL = videoUrl
message.layout = layout
let conversation = activeConversation
conversation?.insert(message, completionHandler: nil)
}
}
你有什么建议?
最佳答案
The media file URL must be a file URL. For video files, the system crops the left and right edges of the media file by 6 points, and rounds its corners. For audio files, it shows a graphical representation of the audio’s waveform.
您只能使用 mediaFileURL 发送本地视频文件。我会尝试在事件 MSConversation 中使用 insertText(_:completionHandler:)
方法发送 View 的内联预览。
关于swift - iMessage 应用 Xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41142447/