1、问题重现方式:请识别下面的二维码,稍候会进入到小程序页面,点开始学习,语音开始播放,这时,点击进度条,会正常跳转到指定位置播放。
如果手机锁屏,然后再进入,点击继续学习,这时应该从指定位置开始播放,但是却从开头开始了。
2、手机 华为 nova7 版本 android10 emui 10.1.1
3、监控日志,发现一个奇怪现象,上述正常跳转时,seek方法后,onseeking,onseekend都会运行,而从头开始播放时,只执行了onseekend,onseeking未触发。
4、代码
onShow: function () {
console.log("onShow"+innerAudioContext.currentTime);
let percent=0;
let playTip="开始学习";
if(innerAudioContext.currentTime>0){
console.log(innerAudioContext.currentTime+" "+innerAudioContext.src);
innerAudioContext.pause();
innerAudioContext.seek(innerAudioContext.currentTime);
percent=Math.round(innerAudioContext.currentTime*100/innerAudioContext.duration);
playTip="继续学习("+percent+"%)";
}
this.setData({
"percent":percent,
"playTipTxt":playTip,
"playBtnBgColor":this.data.mainColor,
"playBtnColor":"#F0F0F0",
"showLoadingIcon":false
})
},