Appearance
通用事件
注意
通用事件为组件的加载状态事件,具体请参考下方说明
用法示例
js
function onEvent(e : JSONObject) {
console.log("onEvent:" + e.toJSONString())
}js
//事件
onEvent(e) {
console.log(e.detail)
}回调示例
json
{
"type": "onAttach",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onCameraClose",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onCameraOpen",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onCancel",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onDetach",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onDeviceClose",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onDeviceOpen",
"data": {
"message": "",
"code": 0,
"data": {
"device": {
"deviceName": "/dev/bus/usb/001/003",
"productName": "RXGD-CAMERA",
"serialNumber": "200901010001",
"vendorId": 3034,
"productId": 12337,
"deviceId": 1003
}
}
}
}json
{
"type": "onQuitFullScreen",
"data": {
"message": "",
"code": 0,
"data": {}
}
}json
{
"message": "",
"code": 0,
"data": {
"status": "start"
}
}
{
"message": "",
"code": 0,
"data": {
"path": "/storage/emulated/0/Android/data/test.leven.uniplugin.com/video/1709286764483.mp4",
"status": "finish"
}
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| type | String | 事件类型,请参考下方说明 |
| data | Object | 事件数据 |
| data.code | Integer | 事件结果类型,0.成功,其他:失败 |
| data.data | Integer | 事件结果数据 |
| data.message | String | 事件结果消息 |
回调事件类型说明
摄像头插入
类型名称
onAttach
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
关闭摄像头
类型名称
onCameraClose
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
打开摄像头
类型名称
onCameraOpen
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
取消设备
类型名称
onCancel
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
断开连接
类型名称
onDetach
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
关闭设备
类型名称
onDeviceClose
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
打开设备
类型名称
onDeviceOpen
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.device | Object | 摄像头数据集合 |
| data.device.productId | Integer | 产品id |
| data.device.productName | String | 产品名称 |
| data.device.serialNumber | String | 串口号 |
| data.device.deviceName | String | 设备名称 |
| data.device.vendorId | Integer | 厂家id |
| data.device.deviceId | Integer | 设备id |
| code | Integer | 返回类型,0.成功,其他:失败 |
退出全屏
类型名称
onQuitFullScreen
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
视频录制结果
类型名称
onRecordingResult
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.status | String | 录制状态start:开始录像finish:结束录像 |
| data.path | String | 录像文件路径,结束录像后会返回 |
| code | Integer | 返回类型,0.成功,其他:失败 |
