在这里记录下这个大坑:
废话不多说直接上干货
重点:导致安卓全屏不了的问题就在于css样式问题
<template>
<view>
<view class="preview-full" v-if="videoUrl!=''">
<video id="myVideo" :src="videoUrl" :show-fullscreen-btn="false" :autoplay="true"></video>
</view>
</view>
</template>
<script>
export default {
data() {
return {
videoUrl: 'xxxxx'
};
},
onReady(){
this.videoContext = uni.createVideoContext('myVideo',this);
this.videoContext.requestFullScreen({direction:90});
},
methods: {
fullscreenchange (e){
if(!e.detail.fullScreen){
this.videoContext.stop()
}
}
}
};
</script>
<style scoped>
.preview-full {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: 1002;
}
.preview-full video {
width: 100%;
height: 100%;
z-index: 1002;
}
</style>