小程序
小游戏
企业微信
微信支付
扫描小程序码分享
wx.getBackgroundAudioManager() 在安卓第一次加载播放时间很快,但在ios上第一次加载很慢,有时能有几分钟,怎么回事?
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
具体机型:iPhone 7 ,iPhone X 微信版本号:7.0.4 系统版本号:IOS 12.3.1
复现代码:
audio.title =
this
.data.programName;
audio.src =
.data.src;
audio.singer =
.data.anchorName;
audio.coverImgUrl =
.data.programImage;
.playAudio();
//播放音频
let that =
;
audio.onTimeUpdate(
function
() {
console.log(audio.currentTime);
that.setData({
startTime: that.dateFormat(audio.currentTime),
duration: that.dateFormat(audio.duration),
offset: (audio.currentTime / audio.duration).toFixed(2) * 100,
currentTime:parseInt(audio.currentTime)
})
app.globalData.currentAudioTime = audio.currentTime
setTimeout(() => {
wx.hideLoading();
}, 300);
//音频自然播放完成
audio.onEnded(() => {
clearInterval(app.globalData.backDmTimer)
app.globalData.currentAudioTime=0;
app.globalData.programBackId=
""
.setData({
audioOperateImg:
'/pageimg/now_play.png'
,
offset:100,
startTime:
.dateFormat(audio.duration)
});
// 加载音频
audio.onWaiting(() => {
wx.showLoading({
title:
'音频加载中…'
.pauseAudio();
currentTime: parseInt(audio.currentTime)
截图:
描述:
点进来之后,一直在加载,也无onWaiting响应,MP4格式几分钟,安卓无问题;AAC格式也要几十秒,安卓无法打开,报文件错误。
http://video.cundtfm.com/661ae809vodcq1259235912/f8d8f3f85285890791418648563/f0.mp4
http://video.cundtfm.com/661ae809vodcq1259235912/c10ee4955285890791421261899/f0.aac
这个格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
不支持MP4格式,aac格式这边测试是正常的
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
具体机型:iPhone 7 ,iPhone X 微信版本号:7.0.4 系统版本号:IOS 12.3.1
复现代码:
audio.title =
this
.data.programName;
audio.src =
this
.data.src;
audio.singer =
this
.data.anchorName;
audio.coverImgUrl =
this
.data.programImage;
this
.playAudio();
//播放音频
let that =
this
;
audio.onTimeUpdate(
function
() {
console.log(audio.currentTime);
that.setData({
startTime: that.dateFormat(audio.currentTime),
duration: that.dateFormat(audio.duration),
offset: (audio.currentTime / audio.duration).toFixed(2) * 100,
currentTime:parseInt(audio.currentTime)
})
app.globalData.currentAudioTime = audio.currentTime
setTimeout(() => {
wx.hideLoading();
}, 300);
})
//音频自然播放完成
audio.onEnded(() => {
clearInterval(app.globalData.backDmTimer)
app.globalData.currentAudioTime=0;
app.globalData.programBackId=
""
;
this
.setData({
audioOperateImg:
'/pageimg/now_play.png'
,
offset:100,
startTime:
this
.dateFormat(audio.duration)
});
// 加载音频
audio.onWaiting(() => {
wx.showLoading({
title:
'音频加载中…'
});
})
audio.title =
this
.data.programName;
audio.src =
this
.data.src;
audio.singer =
this
.data.anchorName;
audio.coverImgUrl =
this
.data.programImage;
this
.pauseAudio();
//播放音频
let that =
this
;
audio.onTimeUpdate(
function
() {
console.log(audio.currentTime);
that.setData({
startTime: that.dateFormat(audio.currentTime),
duration: that.dateFormat(audio.duration),
offset: (audio.currentTime / audio.duration).toFixed(2) * 100,
currentTime: parseInt(audio.currentTime)
})
app.globalData.currentAudioTime = audio.currentTime
setTimeout(() => {
wx.hideLoading();
}, 300);
})
})
截图:
描述:
点进来之后,一直在加载,也无onWaiting响应,MP4格式几分钟,安卓无问题;AAC格式也要几十秒,安卓无法打开,报文件错误。
http://video.cundtfm.com/661ae809vodcq1259235912/f8d8f3f85285890791418648563/f0.mp4
http://video.cundtfm.com/661ae809vodcq1259235912/c10ee4955285890791421261899/f0.aac
这个格式的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
不支持MP4格式,aac格式这边测试是正常的