<audio
class="audioContainer"
ref="audio"
:autoplay="isAutoPlay"
:controls="showControls"
:height="height"
:width="width"
:loop="isLoop"
@ended="ended"
@play="playEvent"
@pause="pauseEvent"
@canplay="readyPlay"
>
<source :src="src" />Your browser does not support the audio tag.
</audio>
- ios手机,html2canvas会对audio产生影响,会让页面的audio重复加载,安卓,其实也有这个问题,但是安卓,只允许存在一个音频。html2canvas的回调如果有延迟,切换页面,还会触发,导致在另一个页面,开启音频。
- 解决办法:在使用html2canvas之前,删除audio标签的autoplay属性。
removeAutoplay() {
this.$refs.audio && this.$refs.audio.removeAttribute('autoplay');
},