本文共 403 字,大约阅读时间需要 1 分钟。
使用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})
转载地址:http://dkhbb.baihongyu.com/