@fullscreenchange="screenChange"
></video>
</view>
</template>
<script>
export default {
data(){
return {
videoUrl: '',
isLoading: false
}
},
onLoad(e) {
let self = this
self.videoUrl = e.url;
self.isLoading = true
setTimeout(() => {
self.play()
},2000)
},
methods: {
videoErrorCallback: function (e) {
console.log('视频错误信息:'+ this.videoUrl)
console.log(e)
},
play(){
let videoContext = uni.createVideoContext("myvideo", this); // this这个是实例对象 必传
videoContext.requestFullScreen({ direction: 0 });
videoContext.play();
this.isLoading = false
},
screenChange(e) {
let fullScreen = e.detail.fullScreen; // 值true为进入全屏,false为退出全屏
if (!fullScreen) {
//退出全屏
uni.navigateBack({
delta: 1,
})
}
},
}
}
</script>
<style lang="less">
.video-play{
video{
width: 100%;
height: 100%;
}
}
</style>
1 个回复
喜欢技术的前端 - QQ---445849201