Category 同人社区

首先在wxml文件中设置video的id

然后在js文件中通过 wx.createVideoContext 获取VideoContext 实例

let videoCtx = null

let app = getApp()

Component({

properties: {

},

data: {

},

attached: function () {

videoCtx = wx.createVideoContext('myVideo', this)

},

methods: {

show: function() {

//进入当前页面

},

hide: function() {

//离开当前页面

videoCtx.pause() //暂停视频

},

}

})

video的使用方法:VideoContext.play()播放视频

VideoContext.pause()暂停视频

VideoContext.stop()停止视频

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

VideoContext.sendDanmu(Object data)发送弹幕

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

VideoContext.requestFullScreen(Object object)进入全屏

VideoContext.exitFullScreen()退出全屏

https://developers.weixin.qq.com/miniprogram/dev/component/video.html

https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/extended/component-plus/video-swiper.html

转 :https://blog.csdn.net/zm_960911/article/details/100573660

Copyright © 2088 宅鬼游戏社 - 二次元游戏活动情报站 All Rights Reserved.
友情链接
top