Howler 音频资源跨域提示html5

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Aimee1608/article/details/83015916

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
})

猜你喜欢

转载自blog.csdn.net/Aimee1608/article/details/83015916
今日推荐