innerAudioContext真机调试延时
发布于 5 年前 作者 fangluo 5395 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

用 innerAudioContext 连续播放5条m4a ,
开发工具测试正常 ,
真机调试第一条延时 , 然后其他没有播放 ,也没有报异常 ,
( 荣耀 , oppo ,都是这样 )
( Iphone5正常 , 可以连续播完 )

  • 预期表现

一条接着一条的播放 , 连续播放5条m4a

  • 复现路径
  • 提供一个最简复现 Demo

var innerAudioContext = wx.createInnerAudioContext();
innerAudioContext.autoplay = false;
innerAudioContext.volume = 1;
innerAudioContext.onEnded(() => {
    go();
})
innerAudioContext.onError((res) => {
    // go();
})
const list = [ //
    ‘https://www.kfqlh.com/sounds/s1.m4a’ //
    , ‘https://www.kfqlh.com/sounds/s2.m4a’ //
    , ‘https://www.kfqlh.com/sounds/s3.m4a’ //
    , ‘https://www.kfqlh.com/sounds/s4.m4a’ //
    , ‘https://www.kfqlh.com/sounds/s5.m4a’ //
];
var lastURL = null;
//
const go = function() {
    if (list.length > 0) {
        lastURL = list.shift();
        innerAudioContext.src = lastURL;
        innerAudioContext.play();
    } else {
        // playing = false;
    }
};
//
Page({
    onLoad: function(options) {},
    onReady: function() {
        go();
    },
})

2 回复

提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

- 复现路径
wechatide://minicode/xIJshlmu7V3B

出现问题的机型有 : vivo X9 , oppo R9 , 荣耀play
微信版本号 : 6.7.3

回到顶部