innerAudioContext.seek有Bug,搞了不知道多久了,微信组件Bug太多?
发布于 6 年前 作者 renjuan 3168 次浏览 来自 官方Issues

我的功能是下次进入页面回到上回播放的地方,也可以点击进度条跳到指定位置。

问题是:回到页面时,点击播放,没有从上回的位置播放,从开头开始了,log日志中发现,调用seek方法后触发了onSeeked,但是没有触发onSeeking。

在一种情况下,可以正常跳转,就是不离开页面,点进度条可以正常跳转。(看log:onSeeking,onSeeEnd都执行了

如果迁移别的页面返回,无法正常跳转。(看log:onSeeking未触发,onSeeEnd触发了)

如果按手机锁屏,然后在进入,同样无法正常跳转。(看log:onSeeking未触发,onSeeEnd触发了)

2 回复

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

        })

    },

你好,麻烦具体描述问题流程,提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部