<video
id="myVideo"
src="{{url}}"
binderror="videoErrorCallback"
show-center-play-btn={{false}}
show-play-btn="{{true}}"
controls
title="课程"
object-fit="fill"
enable-auto-rotation="true"
bindtimeupdate="bindtimeupdate"
></video>
//
let videoCtx = wx.createVideoContext(myVideo, this)
videoCtx.pause()
//bindtimeupdate 获取进度时间,根据时间来进行限制播放操作
bindtimeupdate:function(res){//播放中函数,查看当前播放时间等
let video_status = this.data.video_status
let that = this
if (res.detail.currentTime > 10) {
if (video_status === 0) {
wx.showModal({
title: 登录,
content: 试听课程结束,如需继续查看,请先登录,confirmText:确定,
success (res) {
if (res.confirm) {
wx.switchTab({
url: /pages/user/user
})
} else if (res.cancel) {
wx.navigateBack({
delta: 1,
})
}
}
})
} else if (video_status === 2){
let videoCtx = wx.createVideoContext(myVideo, this)
videoCtx.pause()
wx.showModal({
title: 购买课程,
content: 试听课程结束,如需继续查看,请先购买,confirmText:立即支付,
success (res) {
if (res.confirm) {
that.onClickButton()
} else if (res.cancel) {
wx.navigateBack({
delta: 1,
})
}
}
})
}
} else {
}
},
暂时没有评论,来抢沙发吧~