<cloud-player
class="video"
appid="{{appid}}"
fileid="{{fileid}}"
playurl="{{playurl}}"
playerid="myVideo"
class="video"
width="750rpx"
height="428rpx">
<view
wx:if="{{coverShow}}"
class="my_video_cover"
catchtap="handleTapPlay">
</view>
</cloud-player>
Component({
properties: {
fileid: String,
playurl: String,
},
data: {
appid: 'xxxxxxxxx',
coverShow: true,
},
observers: {
'playurl': function(src) {
if(src) {
this.videoContext = wx.createVideoContext('myVideo', this)
}
}
},
methods: {
handleTapPlay(){
console.log(this.videoContext)
this.setData({
coverShow: false
})
setTimeout(_ => {
console.log('调用播放')
this.videoContext.play()
}, 200)
},
}
})