在這里記錄下這個(gè)大坑:
廢話不多說(shuō)直接上干貨
重點(diǎn):導(dǎo)致安卓全屏不了的問(wèn)題就在于css樣式問(wèn)題文章來(lái)源地址http://www.zghlxwxcb.cn/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>
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-515693.html
到了這里,關(guān)于uni-app小程序video不能自動(dòng)全屏問(wèn)題的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!