veplayer-mp-douyin
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -344,10 +344,10 @@ "use strict"; | ||
const { seeking } = this.data; | ||
const _data = { | ||
ended: true, | ||
paused: true | ||
}; | ||
if (seeking) { | ||
_data.seeking = false; | ||
this.setData({ | ||
seeking: false | ||
}); | ||
} | ||
this.setData(_data); | ||
this.setData({ | ||
ended: true | ||
}); | ||
this._emitEvt(index_1.MediaEvents.ENDED, e); | ||
@@ -354,0 +354,0 @@ }, |
{ | ||
"name": "veplayer-mp-douyin", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "miniprogramType": "tt-npm", | ||
"components": { | ||
"veplayer": "index" | ||
"veplayer": "dist/index" | ||
} | ||
@@ -24,0 +24,0 @@ }, |
@@ -55,3 +55,3 @@ # Veplayer小程序播放器 | ||
<!-- 以下是对一个播放器组件的引用 --> | ||
<xgvideo | ||
<ve-video | ||
id='xgVideo' | ||
@@ -62,3 +62,3 @@ className='xg-video' | ||
playAuthToken='*****************' | ||
></xgvideo> | ||
></ve-video> | ||
</view> | ||
@@ -68,3 +68,3 @@ ``` | ||
> - `playDomain`是调用火山引擎视频点播OpenAPI的接口地址,业务方如果做了该接口的代理,可以替换成业务方的地址。 | ||
> - `playAuthToken`是获取视频播放信息的临时凭证,由业务方服务端通过调用火山服务端SDK本地生成,具体生成参考[火山引擎视频点播文档](https://www.volcengine.com/docs/4/67350#%E6%9C%8D%E5%8A%A1%E7%AB%AF-sdk) | ||
> - `playAuthToken`是获取视频播放信息(包括播放地址,传入此项时不需要传入src)的临时凭证,由业务方服务端通过调用火山服务端SDK本地生成,具体生成参考[火山引擎视频点播文档](https://www.volcengine.com/docs/4/67350#%E6%9C%8D%E5%8A%A1%E7%AB%AF-sdk) | ||
## [组件属性](#VideoProps) | ||
@@ -74,37 +74,42 @@ | ||
| Property | Type | Default | Required | Description | | ||
|----------|-------------------------------|---------|----------|--------------------------------------------------------------------------------------------------| | ||
| mode | 'portrait' \| 'landscape' | 'landscape' | No | 播放器支持竖屏(portrait)及横屏(landscape)两种播放UI模式。横屏模式偏向于普通的PC视频播放器UI,竖屏视频展示类似抖音等短视频播放模式。 | | ||
| src | string | | YES | | | ||
| controls | 'custom' \| 'native'\|'false' | 'custom' | No | custom: 自定义UI,native: 原生组件UI,false: 完全关闭播放UI控件(包括自定义UI及原生组件UI),播放UI控件指loading状态、播控按钮、进度条、时间显示等 | | ||
| show-fullscreen-btn | boolean | | No | 当开始/继续播放时触发play事件 | | ||
| duration | number | | No | 根据官方文档说明,duration属性只是控制显示的时长,不会控制实际播放的时长。因此该属性不设置给原始video组件,只提供给自定义UI使用 | | ||
| bindplay | eventhandle | | No | 当开始/继续播放时触发play事件 | | ||
| bindpause | eventhandle | | No | 当暂停播放时触发 pause 事件 | | ||
| bindended | eventhandle | | No | 当播放到末尾时触发 ended 事件 | | ||
| bindtimeupdate | eventhandle | | No | 播放进度变化时触发,event.detail = {currentTime, duration} 。触发频率 250ms 一次 | | ||
| bindfullscreenchange | eventhandle | | No | 视频进入和退出全屏时触发,event.detail = {fullScreen, direction},direction 有效值为 vertical 或 horizontal | | ||
| bindwaiting | eventhandle | | No | 视频出现缓冲时触发 | | ||
| binderror | eventhandle | | No | 视频播放出错时触发 | | ||
| bindprogress | eventhandle | | No | 加载进度变化时触发,只支持一段加载。event.detail = {buffered},百分比 | | ||
| bindloadedmetadata | eventhandle | | No | 视频元数据加载完成时触发。event.detail = {width, height, duration} | | ||
| bindplaybackratechange | eventhandle | | No | 视频倍速改变完成时触发。返回改变后的倍速值。event.detail={playbackRate}。 | | ||
| bindenterbackground | eventhandle | | No | 进入小窗播放时触发 | | ||
| bindclosebackground | eventhandle | | No | 关闭小窗播放时触发 | | ||
| bindleavebackground | eventhandle | | No | 离开小窗进入 app 事件时触发 | | ||
| bindseeking | eventhandle | | No | 组件内部代理劫持VideoContext,VideoContext.seek 调用后会立即发送该事件,`该事件非video自带事件,只支持 controls="custom" 时才对外发送` | | ||
| bindseekcomplete | eventhandle | | No | seek 完成时触发 (position iOS 单位 s, Android 单位 ms) | | ||
| Property | Type | Default | Required | Description | | ||
|----------|-------------------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| mode | 'portrait' \| 'landscape' | 'landscape' | No | 播放器支持竖屏(portrait)及横屏(landscape)两种播放UI模式。横屏模式偏向于普通的PC视频播放器UI,竖屏视频展示类似抖音等短视频播放模式。 | | ||
| src | string | | No | | | ||
| controls | 'custom' \| 'native'\|'false' | 'custom' | No | custom: 自定义UI,native: 原生组件UI,false: 完全关闭播放UI控件(包括自定义UI及原生组件UI),播放UI控件指loading状态、播控按钮、进度条、时间显示等 | | ||
| show-fullscreen-btn | boolean | | No | 当开始/继续播放时触发play事件 | | ||
| duration | number | | No | 根据官方文档说明,duration属性只是控制显示的时长,不会控制实际播放的时长。因此该属性不设置给原始video组件,只提供给自定义UI使用 | | ||
| playDomain | string | | No | 调用火山引擎视频点播OpenAPI的接口地址,业务方如果做了该接口的代理,可以替换成业务方的地址 | | ||
| playAuthToken | string | | No | 获取视频播放信息(包括播放地址,传入此项时不需要传入src)的临时凭证,由业务方服务端通过调用火山服务端SDK本地生成,具体生成方法参考[火山引擎视频点播文档](https://www.volcengine.com/docs/4/67350#%E6%9C%8D%E5%8A%A1%E7%AB%AF-sdk) | | ||
| bindplay | eventhandle | | No | 当开始/继续播放时触发play事件 | | ||
| bindpause | eventhandle | | No | 当暂停播放时触发 pause 事件 | | ||
| bindended | eventhandle | | No | 当播放到末尾时触发 ended 事件 | | ||
| bindtimeupdate | eventhandle | | No | 播放进度变化时触发,event.detail = {currentTime, duration} 。触发频率 250ms 一次 | | ||
| bindfullscreenchange | eventhandle | | No | 视频进入和退出全屏时触发,event.detail = {fullScreen, direction},direction 有效值为 vertical 或 horizontal | | ||
| bindwaiting | eventhandle | | No | 视频出现缓冲时触发 | | ||
| binderror | eventhandle | | No | 视频播放出错时触发 | | ||
| bindprogress | eventhandle | | No | 加载进度变化时触发,只支持一段加载。event.detail = {buffered},百分比 | | ||
| bindloadedmetadata | eventhandle | | No | 视频元数据加载完成时触发。event.detail = {width, height, duration} | | ||
| bindplaybackratechange | eventhandle | | No | 视频倍速改变完成时触发。返回改变后的倍速值。event.detail={playbackRate}。 | | ||
| bindenterbackground | eventhandle | | No | 进入小窗播放时触发 | | ||
| bindclosebackground | eventhandle | | No | 关闭小窗播放时触发 | | ||
| bindleavebackground | eventhandle | | No | 离开小窗进入 app 事件时触发 | | ||
| bindseeking | eventhandle | | No | 组件内部代理劫持VideoContext,VideoContext.seek 调用后会立即发送该事件,`该事件非video自带事件,只支持 controls="custom" 时才对外发送` | | ||
| bindseekcomplete | eventhandle | | No | seek 完成时触发 (position iOS 单位 s, Android 单位 ms) | | ||
PS. 原生组件支持的属性配置请参考官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/video.html | ||
PS. 原生组件支持的属性配置请参考官方文档:https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/component/media-component/video | ||
## [组件接口](#VideoExportAPIs) | ||
小程序播放器对[VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)进行了封装,提供同原生接口一致的API。原生接口更多细节可阅读[官网](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) | ||
小程序播放器对[VideoContext](https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/media/video/video-context/overview)进行了封装,提供同原生接口一致的API。原生接口更多细节可阅读[官网](https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/media/video/video-context/overview) | ||
```javascript | ||
let player = null | ||
// 异步获取 | ||
const component = this.selectComponent("#videoContainer", (component) => { | ||
player = component.getContext() | ||
}); | ||
// 同步获取,需要保证是在page或者component的ready事件之后才能正常调用 | ||
// player = this.selectComponent("#videoContainer").getContext(); | ||
@@ -116,9 +121,10 @@ // 原生接口 | ||
player.seek(10) | ||
player.sendDanmu(Object data) | ||
player.requestFullScreen() | ||
player.exitFullScreen() | ||
player.setWaterMark({ color: "#FFFF11" }) | ||
player.setMediaVolume({ value: 1}) | ||
player.getMediaVolume(options) | ||
player.playbackRate(1) | ||
player.requestFullScreen({ direction: 90 }) | ||
player.exitFullScreen() | ||
player.exitPictureInPicture() | ||
player.requestBackgroundPlayback() | ||
player.exitBackgroundPlayback() | ||
``` | ||
@@ -125,0 +131,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69597
176
1