微信小程序video--暂停、开启、停止视频等

微信小程序video–暂停、开启、停止视频等

.wxml

<video id='myVideo'></video>

.JS

onLoad: function (options) {
    this.setData({
      videoCtx:wx.createVideoContext('myVideo', this)
    })
  },
//示例(暂停视频)
//this.data.videoCtx.pause()  需要用到的地方使用

videoCtx.play()
播放视频

videoCtx.pause()
暂停视频

videoCtx.stop()
停止视频

videoCtx.seek(number position)
跳转到指定位置

videoCtx.sendDanmu(Object data)
发送弹幕

videoCtx.playbackRate(number rate)
设置倍速播放

videoCtx.requestFullScreen(Object object)
进入全屏

videoCtx.exitFullScreen()
退出全屏


有什么问题欢迎评论留言,我会及时回复你的

原创文章 75 获赞 87 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_43764578/article/details/105228117