首页 > 编程知识 正文

Howler 音频资源跨域提示html5

时间:2023-05-04 06:54:14 阅读:191093 作者:1753

Howler 音频资源跨域提示html5

使用howler 播放音频时,会遇到资源跨域报错,因为Howler默认使用Web Audio,但在IE上可以自动转为HTML 5 Audio,而web audio兼容性不是很好,可以使用HTML 5 Audio

this.sound = new Howl({src: [this.src],preload: this.preload,html5: true, // 设置为true 页面将使用原生video 标签渲染 不会导致资源跨域的情况onload: (e) => {this.duration = this.sound.duration()this.loading = false},onplay: this.setInterval,onpause: this.clearInterval,onend: this.setEnd})

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。