收藏
回答

iOS真机InnerAudioContext更换src后不触发onCanplay事件?

init(options) {
        this.InnerAudioContext.stop();
        let {
            elem
        } = options;
        this.InnerAudioContext.offEnded();
        this.InnerAudioContext.offCanplay();
        this.InnerAudioContext.offTimeUpdate();
        this.InnerAudioContext.src = elem.src;
        if (elem.currentTime != '00:00') {
            let splitArr = elem.currentTime.split(':');
            let seekCount = Number(splitArr[0]) * 60 + Number(splitArr[1]);
            this.seek(seekCount);
        }
        this.InnerAudioContext.onCanplay(() => { 
    //二次执行init方法,改变src, onCanplay事件不触发, ios真机 iPhoneX 14.4.2
            console.log(this.InnerAudioContext.paused);
            // typeof options.success === 'function' && options.success();
            EventBus.emit('onSuccess', elem);
        });

}
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容