uniapp打包成安卓video标签层级问题解决
<template>
<iframe :onload="onloadCode" style="width:100%;height:100%;border:1px solid #fff;background: #000;"></iframe>
</template>
<script>
export default {
props: {
src: '',
},
data() {
return {
onloadCode: ''
}
},
methods:{
play(index) {
let videoContext = uni.createVideoContext('videoId', this)
videoContext.requestFullScreen()
},
//退出全屏时暂停
fullscreenchange(e) {
if (!e.detail.fullScreen) {
uni.createVideoContext('videoId', this).pause();
}
},
},
created() {
console.log(this.src)
this.onloadCode =
`this.contentWindow.document.body.innerHTML = '<video style="width: 100%;height: 100%" controls :direction="90" @play="play" @fullscreenchange="fullscreenchange" id="videoId" src="${this.src}"></video>';`
},
}
</script>
<style lang="scss">
</style>