小程序视频列表中视频的播放与停止-小程序实现视频播放-视频播放小程序
视频的播放与暂停
2.https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html
3.VideoContextVideoContext实例,可通过wx.createVideoContext获取。
4.VideoContext通过id跟一个video组件绑定,操作对应的video组件。
5.方法VideoContext.play()播放视频
6.VideoContext.pause()暂停视频
7.VideoContext.stop()停止视频
8.VideoContext.seek(numberposition)跳转到指定位置
9.VideoContext.sendDanmu(Objectdata)发送弹幕
10.VideoContext.playbackRate(numberrate)设置倍速播放
11.VideoContext.requestFullScreen(Objectobject)进入全屏
12.VideoContext.exitFullScreen()退出全屏
13.VideoContext.showStatusBar()显示状态栏,仅在iOS全屏下有效
14.VideoContext.hideStatusBar()隐藏状态栏,仅在iOS全屏下有效
viewclass"sectiontc"videoid"myVideo"src"http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400bizid1023hySHfileparam302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"enable-danmudanmu-btncontrols/videoviewclass"btn-area"inputbindblur"bindInputBlur"/buttonbindtap"bindSendDanmu"发送弹幕/button/view/viewfunctiongetRandomColor(){letrgb[]for(leti0;i3;++i){letcolorMath.floor(Math.random()*256).toString(16)colorcolor.length1?'0'+color:colorrgb.push(color)}return'#'+rgb.join('')}Page({onReady(res){this.videoContextwx.createVideoContext('myVideo')},inputValue:'',bindInputBlur(e){this.inputValuee.detail.value},bindSendDanmu(){this.videoContext.sendDanmu({text:this.inputValue,color:getRandomColor()})}})声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

