我目前正在研究一种将视频短视频(10-30秒)上传到我的数据库的方法,并询问是否可以将视频从本地图库转换为base64,目前我使用 imagePickerController 获取视频你可以在这段代码中看到:
func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
//Here is save the video URL
let url = info[.mediaURL] as? URL
//Here goes the code to convert this video URL to base64...
self.dismiss(animated: true)
}
Run Code Online (Sandbox Code Playgroud)
我还想知道是否可以将视频保存到 Base64 并将其发送到我的发布请求正文中,或者我应该使用其他方式将视频上传到服务器中?我愿意接受任何建议,谢谢