微信小程序video调用play方法无效,正解!
直接上代码,先解决问题,解决了记得回来点赞哈:视频正常播放,这里查了太多资料终于解决了,记得wx.createVideoContext(‘myvideo2’, this),记得加this,记得加this,记得加this,说三遍。
<video
id="myvideo2"
src='https://peacebird-img.oss-cn-shanghai.aliyuncs.com/wx/2019-12-11-bar-12.mp4'
controls>
</video>
<view class="box">
<text wx:if="{{!item.play}}" bindtap="videoPlay">△</text>
</view>
//下面是JS部分
videoPlay() { //播放视频
let videoplay = wx.createVideoContext('myvideo2', this)
videoplay.play();
}