视频直播app源码,cordova Vue 保存视频/图片到相册
视频直播app源码,cordova Vue 保存视频/图片到相册
完整代码
/*
* url: 视频源地址
* album: 视频名称
* success:成功回调
* error: 失败回调
* library: 请求相册权限失败回调
*/
function saveVideoToPhotoLibrary(url, album, success, error, library) {
let fileURL = cordova.file.dataDirectory + album + '.mp4'; // 可改为指定路径
let fileTransfer = new FileTransfer();
let uri = encodeURI(url);
fileTransfer.download(uri,fileURL, (entry) => {
cordova.plugins.photoLibrary.requestAuthorization(() => {
// User gave us permission to his library, retry reading it!
cordova.plugins.photoLibrary.saveVideo(entry.toURL(), album, success, error);
}, library, {
read: true,
write: true
});
}, error);
}
以上就是视频直播app源码,cordova Vue 保存视频/图片到相册, 更多内容欢迎关注之后的文章