🎁
YY-EVA wechat
YYEVA 微信小程序播放器,同时支持 H265、H264
配置
选项 | 作用 | 默认值 | 必填 |
---|---|---|---|
videoUrl | mp4地址 | * | |
loop | 是否循环、循环次数 | true、number | |
mode | 显示方式 横竖屏 | 根据父容器等比缩放 | |
fps | 礼物播放动画帧数 | 根据素材获取、可主动降帧 | |
useVideoDBCache | 缓存视频 | true | |
mute | 静音播放、根据环境自动调整 | true | |
alphaDirection | 非带Key视频,适配alpha 位置 | right |
|
effects | 根据素材传入相应的素材内容 | ||
checkTimeout | 检查播放超时 | false |
安装
- 初始化 确保小程序根目录存在
package.json
; 可以通过npm init
创建 - 安装 yyeva 小程序依赖
npm i yyeva-wechat
- 构建 点击开发者工具中的菜单栏:工具 --> 构建 npm
- 引用 用例如:通过
pages/index/index.json
配置
{
"usingComponents": {
"yyeva":"yyeva-wechat"
}
}
使用
- 点击右上角 微信开发工具 详情 -> 本地设置 将 [js编译成 es5] 打开
index.js、index.ts
Page({
data: {
options: {
videoUrl: `mp4 url`,
},
},
onEnd() {},
onStart() {},
onStop() {},
onLoad() {},
})
index.wxml
<yyeva
options="{{options}}"
bind:onEnd="onEnd"
bind:onStart="onStart"
bind:onStop="onStop"
/>