在这里记录下这个大坑:
废话不多说直接上干货
重点:导致安卓全屏不了的问题就在于css样式问题文章来源地址https://www.toymoban.com/news/detail-515693.html
<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>
文章来源:https://www.toymoban.com/news/detail-515693.html
到了这里,关于uni-app小程序video不能自动全屏问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!