uni-app中的video获取通过onReady:
onReady:function(res){ this.videoCon = uni.createVideoContext('myVideo',this) }
<template>
<view class="content">
<video src="/static/int.mp4" controls="" id="myVideo"></video>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
onShow(){
this.videoCon.play();
},
onHide(){
this.videoCon.pause();
},
onReady:function(res){
this.videoCon = uni.createVideoContext('myVideo',this)
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
video{
width: 750upx;
}
</style>
版权声明:本文为m0_55041880原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。