Appearance
方法事件
注意
方法事件为组件方法调用后异步回调事件
用法示例
js
//事件
onEventMethod(e) {
console.log(e.detail)
}js
function onEventMethod(e : JSONObject) {
console.log("onEvent:" + e.toJSONString())
}回调示例
json
{
"type": "play",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "pause",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "resume",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "stop",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "replay",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "seekTo",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "setSpeed",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "setLoop",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "switchPlayMode",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "getPlayerMode",
"data": {
"data": {
"result":"FLOAT"
},
"message": "",
"code": 0
}
}json
{
"type": "getPlayerState",
"data": {
"data": {
"result":"PLAYING"
},
"message": "",
"code": 0
}
}json
{
"type": "setStartTime",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "snapshot",
"data": {
"data": {
"base64":"",
"path":""
},
"message": "",
"code": 0
}
}json
{
"type": "addDanmaku",
"data": {
"data": {},
"message": "",
"code": 0
}
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| type | String | 事件类型,请参考下方说明 |
| data | Object | 事件数据 |
| data.code | Integer | 事件结果类型,0.成功,其他:失败 |
| data.data | Integer | 事件结果数据 |
| data.message | String | 事件结果消息 |
回调事件类型说明
播放下一个视频
类型名称
play
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
暂停播放
类型名称
pause
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
恢复播放
类型名称
resume
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
停止播放
类型名称
stop
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
重播
类型名称
replay
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
跳转到指定位置
类型名称
seekTo
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置播放速度
类型名称
setSpeed
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置循环播放
类型名称
setLoop
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
切换播放模式
类型名称
switchPlayMode
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取播放模式
类型名称
getPlayerMode
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.result | String | 获取结果 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取播放状态
类型名称
getPlayerState
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.result | String | 获取结果,结果类型如下:INIT PLAYING PAUSE LOADING END ERROR |
| code | Integer | 返回类型,0.成功,其他:失败 |
设置开始播放时间
类型名称
setStartTime
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
截图
类型名称
snapshot
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.base64 | String | base64数据 |
| data.path | String | 图片保存路径 |
| code | Integer | 返回类型,0.成功,其他:失败 |
添加弹幕
类型名称
addDanmaku
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |

