bindplay(e) {//视频播放事件
////这里的vid是视频的id
let vid = e.currentTarget.id;
if(this.vid !== vid && this.videoContext){
////关闭上一个播放的视频
this.videoContext.stop();
}
this.vid = vid;
////创建控制视频标签的实例对象
this.videoContext = wx.createVideoContext(this.vid,this);
}
关键点:
- 找到上一个视频的实例对象
- 如何确认点击播放的视频和正在播放的视频不是同一个
查看作者在项目中如何使用的效果如下

image
源码请移步gitee:https://gitee.com/aggressiving/Catch-nong-net#catch-nong-net
或者github:https://github.com/jack-mayuan/Catch-nong-net