video是视频播放组件。
组件用法:
wxml
- <!--监听button点击事件-->
- <button bindtap="listenerButton">点击显示视频组件</button>
- <!--视频组件src资源地址,binderror为监听错误信息-->
- <video
- src="https://mvvideo1.meitudata.com/575c2b652d7375255.mp4"
- style="width: 100%; height: 100%"
- hidden="{{hiddenVideo}}"
- binderror="listenerVideo" />
js
- Page({
- data:{
- // text:"这是一个页面"
- hiddenVideo: true
- },
- /**
- * 监听视频加载错误状态
- */
- listenerVideo:function(e) {
- console.log(e.detail.errMsg);
- },
- /**
- * 监听button点击事件
- */
- listenerButton:function() {
- this.setData({
- hiddenVideo: !this.data.hiddenVideo
- })
- }
- })
主要属性:
属性
|
描述
|
hidden | 设置视频的显示(true)/隐藏(false),默认为false |
src | 要播放视频的资源地址 |
binderror |
发生错误时触发error事件 |