问题:微信内打开H5程序video不能播放
使用框架:Nuxt3
引入微信SDK:http://res.wx.qq.com/open/js/jweixin-1.1.0.js
现象:WeixinJSBridgeReady的监听回调未执行
代码片段:
<template>
<div class="main">
<video
ref="previewVideo"
muted
loop
preload="auto"
width="100%"
height="100%"
playsinline
x-webkit-airplay="true"
webkit-playsinline="true"
x5-video-player-type="h5-page"
x5-video-orientation="portraint"
src="https://media.w3.org/2010/05/sintel/trailer.mp4"
>
</video>
</div>
</template>
<script setup>
const previewVideo = ref(null)
onMounted(() => {
document.addEventListener('WeixinJSBridgeReady', function () {
alert(1)
previewVideo.value.play()
})
})
</script>
<style>
.main{
height: 100vh;
width: 100vw;
}
</style>
构建个复现页面?