Using UIActivityViewController to share a video

邮差的信 提交于 2019-12-04 12:43:18

You need a file URL to the video file or and ALAsset representing the video. Use either of those as the object in your activityItems array.

For swift 3.0 OR up

let url = URL(fileURLWithPath: "URL String Here")
let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
activityViewController.popoverPresentationController?.sourceView = controller.view // so that iPads won't crash
controller.present(activityViewController, animated: true, completion: nil)

If you are using an avasset, you can get the url using (AVUrlAsset*)AVAsset.url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!