微信小程序——video视频播放
1、功能介绍
部署
互联网
app安装失败
可以实现视频的播放暂停,发送弹幕,获取视频所处位置等。
三极管
2、video组件
npm配置
2.1、用处
低功耗蓝牙连接
video组件常用于视频的播放,默认宽度为300px,高度为225px。
核心网
2.2、属性
go语言
属性 | 说明 |
src | 视频的资源地址 |
loop | 是否循环播放,默认false |
controls | 是否显示默认播放按钮(暂停,播放进度,时间)默认为true |
danmu-list | 弹幕列表 |
danmu-btn | 是否显示弹幕按钮,只在初始化有效,不能动态变更,默认为false |
enable-danmu | 是否展示弹幕,只在初始化有效,不能动态变更,默认false |
autoplay | 是否自动播放,默认false |
poster | 视频封面的图片网络资源地址,如果controls属性为false,则设置poster无效 |
bindplay | 当播放时触发play事件 |
bindpause | 当暂停播放时触发pause事件 |
3、index.js中的数据部分
QT样式
data: {
src:"http://localhost:3000/1.mp4",
danmuList:[
{text:'first',color:'#ff0000',time:1},
{text:'second',color:'#008080',time:2},
{text:'three',color:'#ff00ff',time:3}
]
},
4、结构布局index.wxml
小说
<video id="myVideo" src='{{src}}' danmu-list="{{danmuList}}" enable-danmu danmu-btn controls></video>
<input bindblur="bindInputBlur"/>
<button bindtap="bindSendDanmu">发送弹幕</button>
<button bindtap="bindButtonTap">获取视频</button>
5、样式部分index.wxss
位置闭环控制
video{
width: 100vw;
}
input{
border: 1rpx solid #ccc;
margin: 20rpx;
}
button{
background-color: rgb(76, 250, 114);
}
button{
margin-bottom: 10rpx;
}
6、弹幕实现功能
Monkey测试
videoContext:null,
inputValue:'',
onReady:function(){
this.videoContext=wx.createAudioContext('myVideo')
},
bindInputBlur:function(e){
this.inputValue=e.detail.value
},
bindSendDanmu: function () {
this.videoContext.sendDanmu({
text: this.inputValue,
color: "#f90"
})
},
创建的videoContent对象,用于对video组件进行控制
open函数
7、获取视频功能
Java新手必做题目
swiftui
bindButtonTap:function(){
wx.chooseVideo({
sourceType:['album','camera'],
maxDuration:60,
camera: 'back',
success:res=>{
this.setData({
src:res.tempFilePath
})
}
})
}
8、运行效果
循环神经网络
sqlite
STM32+MODBUS
python_error
声明:本站博客内容版权均属于原作者所有,这里所提供资源均只能用于参考学习用,书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。