体验版、开发版、真机测试1.0+2.0保存视频到相册都没有问题,为啥一发布就不能保存相册了呢(触发提示:请尝试[备用下载]或重新解析,若无法解决请反馈客服谢谢~)
wx2b7815ed58ae519a
l[w] = wx.downloadFile({
//header: t,
url: url,
//filePath: b,
success: function(r) {
if ( (h = setTimeout((function() {
"100%" != l.data.progress && "100%" != l.data.progress0 || (l.setData({
ka100: !0
}), wx.downloadFile({
content: "卡100",
kaquxiao: l.data.kaquxiao,
kaguanbi: l.data.kaguanbi,
mrmsg: d,
url: urls,//n,
val: l.data.val,
dataLength: r.dataLength,
statusCode: r.statusCode,
iszoufuwuqi: s,
//downloadType: e.globalData.downloadType,
header: JSON.stringify(t)
}))
}))), 200 == r.statusCode || s || wx.downloadFile({
//content: "状态码错误",
//statusCode: r.statusCode,
//mrmsg: d,
url: urls,//n,
//ssu: url,//t.ssu,
//downnum: i,
//header: JSON.stringify(t)
}), 404 === r.statusCode) {
l.setData(g);
try {
var w = r.header.message ? decodeURI(r.header.message) : "视频太大小程序不支持.安卓用户请复制解析后的链接到QQ浏览器下载.苹果用户请看页面底部手动下载教程!"
} catch (a) {
w = "视频太大小程序不支持.安卓用户请复制解析后的链接到QQ浏览器下载.苹果用户请看页面底部手动下载教程!"
}
if (-1 != w.indexOf("!") ? wx.showModal({
title: "提示",
content: w,
confirmText: "确定",
cancelText: "查看教程",
success: function(a) {
a.confirm || wx.navigateTo({
url: "/hs_video/pages/jiaocheng/index"
})
}
}) : wx.showModal({
title: "提示",
content: w,
showCancel: !1,
success: function(a) {}
})) wx.getFileSystemManager().unlink({
filePath: b,
success: function(a) {
console.log(a)
},
fail: function(a) {
console.log(a)
}
})
} else
wx.saveVideoToPhotosAlbum({
filePath: r.tempFilePath,
success: function(w) {
wx.getFileSystemManager().unlink({
filePath: r.tempFilePath,
success: function(a) {
console.log(a)
},
fail: function(a) {
console.log(a)
}
});
if (l.setData(({
socket: 200 != r.statusCode && r.dataLength < 5242
}, g)), 200 != r.statusCode && r.dataLength < 5242 ? urls ? s || 0 != i || (l.data.buttonClicked = !1, l.data.buttonClicked2 = !1, l.setData({
progress: "",
socket: !1
}), o = 1, wx.showToast({
title: "保存失败,自动尝试备用下载中,请勿离开页面",
icon: "none",
mask: !0
}), setTimeout((function() {
l.data.buttonClicked2 = !0, l.beiyongdown("问题备用")
}), 1e3)) : wx.showModal({
title: "提示",
content: "下载可能有问题,请检查.如果相册里面的不能播放,请点击[备用下载],如果没问题请忽略,如果无法解决请反馈客服谢谢~",
showCancel: !1
}) : wx.showModal({
content: "保存成功",
showCancel: !1
}), r.dataLength < 5242 && wx.downloadFile({
content: "可能有问题",
mrmsg: d,
header: JSON.stringify(t),
url: urls,//n,
downnum: i,
iszoufuwuqi: s,
dataLength: r.dataLength,
statusCode: r.statusCode,
profile: JSON.stringify(r)
}), c || l.data.kaquxiao || l.data.kaguanbi || l.data.ka100) {
var f = parseInt((new Date).valueOf() / 1e3) - u,
h = "收集";
l.data.ka100 && (h = "卡100自动成功"), l.data.kaquxiao && (h = "取消下载后保存成功"), l.data.kaguanbi && (h = "关闭后保存成功"), c && (h = "备用下载成功"), wx.downloadFile({
content: h,
mrmsg: d,
header: JSON.stringify(t),
url: urls,//n,
kaquxiao: l.data.kaquxiao,
kaguanbi: l.data.kaguanbi,
useTime: f,
downloadType: l.downloadType
})
}
},
fail: function(a) {
(wx.hideLoading()) && wx.getFileSystemManager().unlink({
filePath: r.tempFilePath,
success: function(a) {
console.log(a)
},
fail: function(a) {
console.log(a)
}
});
l.setData(g);
var c = parseInt((new Date).valueOf() / 1e3) - u,
w = a.errMsg,
f = "保存失败:" + w,
h = !1,
p = !1;
s || (p = !0, f = "请尝试[备用下载]或重新解析,若无法解决请反馈客服谢谢~");
for (var x = 0; x < 0; x++) {
var m = e.globalData.savefaillist[x];
if (-1 != w.indexOf(m.key)) {
h = !0, f = m.msg;
break
}
if (w == m.key) {
if (f = m.msg, 0 == m.socket && (p = !1), m.again && !s && 0 == i) return l.data.buttonClicked = !1, l.data.buttonClicked2 = !1, l.setData({
progress: "",
socket: !0
}), o = 1, wx.showToast({
title: "保存失败,自动尝试备用下载中,请勿离开页面",
icon: "none",
mask: !0
}), void setTimeout((function() {
l.data.buttonClicked2 = !0, l.beiyongdown("问题备用2")
}), 1e3);
break
}
if (m.indexof && -1 != w.indexOf(m.key)) {
f = m.msg, 0 == m.socket && (p = !1);
break
}
}
(p = !0, -1 != w.indexOf("system deny") && (f = "保存已取消")), l.setData({
socket: p
}), wx.showModal({
title: "提示",
content: f,
showCancel: !1,
success: function(a) {
h && wx.navigateToMiniProgram({
appId: "wxe9ec9c0bb6995436"
})
}
}), wx.getSetting({
success: function(a) {
if (!a.authSetting['scope.writePhotosAlbum']) {
// 没有权限,引导用户授权
wx.authorize({
scope: 'scope.writePhotosAlbum',
success() {
// 用户授权成功,执行保存视频的操作
a.authSetting["scope.writePhotosAlbum"] || (l.data.socket && l.setData({
socket: !1
}), wx.showModal({
title: "授权失败",
content: "你已拒绝授权,如果要保存到相册,请打开授权",
confirmText: "打开",
success: function(a) {
a.confirm && wx.openSetting({
success: function(a) {
a.authSetting["scope.writePhotosAlbum"] ? wx.showToast({
title: "授权成功请点击下载",
icon: "none"
}) : wx.showToast({
title: "授权失败,请开启按钮",
icon: "none"
})
}
})
}
}))
},
fail() {
// 用户拒绝授权
wx.showModal({
title: '提示',
content: '需要授权才能保存视频到相册,请去【设置】->【授权设置】页打开',
showCancel: false
});
}
});
}/* else {
// 已有权限,直接执行保存视频的操作
this.saveVideo();
}*/
}
}), wx.downloadFile({
content: JSON.stringify(a),
mrmsg: d,
url: urls,//n,
header: JSON.stringify(t),
//version: e.globalData.version,
iszoufuwuqi: s,
showErrMsg: f,
downnum: i,
useTime: c,
statusCode: r.statusCode,
socket: p,
//downloadType: e.globalData.downloadType,
kaquxiao: l.data.kaquxiao,
kaguanbi: l.data.kaguanbi
})
},
complete: function(a) {
l.data.buttonClicked = !0, l.data.buttonClicked2 = !0, l.data.kaquxiao = !1, l.data.kaguanbi = 0, l.data.ka100 && l.setData({
ka100: !1
}), h && clearTimeout(h)
}
})
},
fail: function(a) {
wx.getFileSystemManager().unlink({
filePath: a.tempFilePath,
success: function(a) {
console.log(a)
},
fail: function(a) {
console.log(a)
}
});
console.log("下载错误", a);
try {
l[w].offProgressUpdate()
} catch (a) {}
l.setData(g);
var t = a.errMsg,
n = "",
c = 0,
r = !1,
f = 1,
h = parseInt((new Date).valueOf() / 1e3) - u;
if (-1 != l.data.newurl.indexOf("请")) n = l.data.newurl;
else
for (var p = 0; p < 0; p++) {
//var x = e.globalData.downfaillist[p];
if (0 == i) return console.log("再次下载"), void l.godown(0, "notin下载" + t, 1);
if (a.errno) n = x.msg, x.jiaocheng && (c = 1), (f = 0), (e.globalData.downloadType = downloadType);
else {
if (t) {
n = x.msg, x.jiaocheng && (c = 1), 0 == x.limitgo && (f = 0), x.downloadType;
break
}
if (x.indexof && -1 != t.indexOf(x.key)) {
n = x.msg, x.jiaocheng && (c = 1), 0 == x.limitgo && (f = 0), x.downloadType;
break
}
}
}
if ("" == n && (s ? (c = 1, n = "请复制解析后的链接手动下载~") : n = "请点击尝试[备用下载],或重新解析,或请手动下载~"), !s && !c && 0 == i && 1 == l.data.buttonClicked2 && f) return l.data.buttonClicked = !1, l.data.buttonClicked2 = !1, l.setData({
progress: "",
socket: !0
}), o = 1, wx.showToast({
title: "下载失败,自动尝试备用下载中,请勿离开页面",
icon: "none",
mask: !0
}), void setTimeout((function() {
l.data.buttonClicked2 = !0, l.beiyongdown("自动备用" + t)
}), 1e3);
(!s && !c || i > 0 && !c) && (r = 1, l.setData({
socket: !0
})), c ? wx.showModal({
title: "提示",
content: "下载失败:" + n,
confirmText: "确定",
cancelText: "查看教程",
success: function(a) {
a.confirm || wx.navigateTo({
url: "/hs_video/pages/jiaocheng/index"
})
}
}) : wx.showModal({
title: "提示",
content: "下载失败:" + n,
showCancel: !1
}), wx.downloadFile({
content: i ? "备用下载失败" + JSON.stringify(a) : JSON.stringify(a),
mrmsg: d,
url: l.data.newurl,
useTime: h,
showErr: n,
iszoufuwuqi: s,
downnum: i,
socket: r,
socket2: l.data.socket,
jiaocheng: c,
//autobeifendown: e.globalData.autobeifendown,
//downloadType: e.globalData.downloadType
})
},
complete: function(a) {
o ? o = 0 : (l.data.buttonClicked = !0, l.data.buttonClicked2 = !0), f && clearTimeout(f)
}
})
打开调试看看报什么错
你体验版是不是开启了调试模式的,开发工具是不是勾选了不校验域名的
downloadFile域名没配置吧