小程序保存视频到本地(封装)
function getVideoStting(url) { return new Promise((reslove, reject) => { if (url) { wx.showLoading({ title: '保存中', mask: true }) wx.getSetting({ success(res) { wx.downloadFile({ url: url, success: function (res) { console.log(res) var temp = res.tempFilePath wx.saveVideoToPhotosAlbum({ filePath: temp, success: function (res) { reslove(res) }, fail: function (err) { wx.hideLoading() reject(err) } }) }, fail: function (err) { wx.hideLoading() wx.utils.alert('保存失败') } }) }, fail(res) { } }) } else { wx.showLoading({ title: '请稍等', mask: true }) setTimeout(() => { wx.hideLoading() }, 1000) } })}module.exports = { getVideoStting}
然后 调用方法就可以啦
挂在到wx
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

