video组件视频播放不了?
<block wx:for="{{videoList}}" wx:key="index">
<view class="university-item">
<video class="myVideo" id="myVideo{{index}}" src="{{item.videoUrl}}" binderror="videoErrorCallback" danmu-list="{{danmuList}}" show-center-play-btn="{{false}}" show-play-btn="{{true}}" controls picture-in-picture-mode="{{['push', 'pop']}}" poster="{{item.coverUrl}}"></video>
<image wx:if="{{index!=indexCurrent}}" data-index="{{index}}" class="play-icon" src="../../assets/images/pageIcon/play_icon.png" bindtap="playVideo"></image>
</view>
</block>
data: {
videoList: [],
pageNum: 1,
hasLoadingOver: false,
isLoading: false,
hasEmptyList: false,
indexCurrent: null
},
playVideo(e) {
const curIdx = e.currentTarget.dataset.index
// 没有播放时播放视频
if (this.data.indexCurrent !== null) {
const videoContextPrev = wx.createVideoContext('myVideo' + this.data.indexCurrent)
if (this.data.indexCurrent !== curIdx) {
videoContextPrev.pause()
}
}
const videoContext = wx.createVideoContext('myVideo' + curIdx) // 这里对应的视频id
videoContext.play()
this.setData({
indexCurrent: curIdx
})
},