- during the development of the player, the real machine debugging found that the uc browser could not trigger the play event of the audio tag, nor could it play it automatically.
- Test code
<template>
<div class="audio-wrapper" ref="audioWrapper" @touchstart.stop="audioPlay">
<audio @touchstart.stop @play="playing"
src="//dl.stream.qqmusic.qq.com/C400000fcbn33tw0lQ.m4a?vkey=2287E4C8B54E21B92310DD2BE8218EF9FFDBAA41889FC74A90C23350F387C462F09AD6B9AEB411E2C7E8CBB8E5498BE09F0AB24D4A039FEB&guid=4339008184&uin=0&fromtag=66"
ref="audio" controls ></audio>
</div>
</template>
<script>
export default {
methods: {
audioPlay () {
console.log(this.$refs.audio)
console.log(this.$refs.audio.play)
this.$refs.audio.play()
},
playing () {
console.log("playing")
}
}
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
.audio-wrapper
position: fixed
width: 100%
height: 100%
background-color: rgba(0, 0, 0, 0.6)
</style>
3. Test results
after the touchstart event is triggered in the uc browser, the audio tag dom and the play () method are printed, but the console in the ready method called by the play event d of the audio tag is not executed and the song is not played
qqtouchstart audiodom , play() , pinging
the bosses who answered looked up and bowed their heads to pick up the money!