bindplay(e) {//視頻播放事件
////這里的vid是視頻的id
let vid = e.currentTarget.id;
if(this.vid !== vid && this.videoContext){
////關(guān)閉上一個(gè)播放的視頻
this.videoContext.stop();
}
this.vid = vid;
////創(chuàng)建控制視頻標(biāo)簽的實(shí)例對(duì)象
this.videoContext = wx.createVideoContext(this.vid,this);
}
關(guān)鍵點(diǎn):
- 找到上一個(gè)視頻的實(shí)例對(duì)象
- 如何確認(rèn)點(diǎn)擊播放的視頻和正在播放的視頻不是同一個(gè)
查看作者在項(xiàng)目中如何使用的效果如下

image
源碼請(qǐng)移步gitee:https://gitee.com/aggressiving/Catch-nong-net#catch-nong-net
或者github:https://github.com/jack-mayuan/Catch-nong-net