<video style="width:690rpx" id="myVideo{{idx}}"
poster="{{ossUrl+listItem.url+'?x-oss-process=video/snapshot,t_100,m_fast'}}" src="{{ossUrl+listItem.url}}"
binderror="videoErrorCallback" object-fit="contain" show-play-btn="{{true}}" controls data-index='{{idx}}'
bindtap="videoPlay"></video>
videoPlay: function (e) {
var that = this;
var curIdx = e.currentTarget.dataset.index;
if (that.data.indexCurrent != null) {
console.log('aa')
var videoContextPrev = wx.createVideoContext('myVideo' + that.data.indexCurrent)
if (that.data.indexCurrent != curIdx) {
console.log('cc')
videoContextPrev.pause()
}
that.setData({
indexCurrent: curIdx
})
var videoContextCurrent = wx.createVideoContext('myVideo' + curIdx)
videoContextCurrent.play()
if(curIdx ==that.data.indexCurrent ){
videoContextPrev.pause()
}
} else {
console.log('bb')
that.setData({
indexCurrent: curIdx
})
var videoContext = wx.createVideoContext('myVideo' + curIdx)
videoContext.play()
}
},
网上找了很多个方法,在我这里都不行,上面写法有啥问题吗?