标签: video-gallery

如何快速将本地视频转换为base64?

我目前正在研究一种将视频短视频(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 并将其发送到我的发布请求正文中,或者我应该使用其他方式将视频上传到服务器中?我愿意接受任何建议,谢谢

base64 ios video-gallery swift urlsession

2
推荐指数
1
解决办法
2148
查看次数

标签 统计

base64 ×1

ios ×1

swift ×1

urlsession ×1

video-gallery ×1