更新记录
1.0(2024-12-27) 下载此版本
V1.0 初始版本
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | 4.4 | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | - | - | - |
插件集成说明
插件引入
将uts插件wif-ipc
放入项目的uni_modules
目录下,在界面中导入相应插件功能,如下:
// 导入要使用的插件
import {
bindService,
requestHistoryVideo,
requestStreaming,
requestGetCameraList,
requestStopStreaming
} from "../../uni_modules/wif-monitor";
初始化
在使用插件功能之前,需要先进行初始化,初始化成功后即可使用其他功能:
返回值 bind 为 true 即为初始化成功
onLoad() {
bindService({
result: (bind) => {
console.log("bindService response bind:" + bind)
this.connectionStatus = bind
}
});
}
功能说明
插件功能接口
1. 获取摄像头列表
arg1 代表柜号,开几号柜子就输入几号,例如:开十号柜子arg1就是10
requestGetCameraList({
response: (res) => {
// 解析摄像头列表
try {
console.log("解析摄像头列表 res:" + res)
const resJson = JSON.parse(res);
this.cameraList = JSON.parse(resJson.msg);
} catch (e) {
console.error("解析摄像头列表失败:", e);
this.cameraList = [];
}
}
})
返回结果:
code: 1-操作成功 0-操作失败 -1-异常
{"code":1,"failCode":0,"msg":"[{\"ipAddress\":\"192.168.43.25\",\"serialNumber\":\"037a0002006e02a859bf\"},{\"ipAddress\":\"192.168.43.24\",\"serialNumber\":\"037a0002006e02ac5bfa\"}]","type":"com.wif.monitor.action.GET_CAMERA_LIST"}
2. 推流
参数
arg1:摄像头编号 ,arg2:推流地址
requestStreaming({
arg1: this.pushIpcSn,
arg2: this.pushUrl,
response: (res) => {
console.log("requestStreaming res:" + res)
}
})
返回结果:
code: 1-操作成功 0-操作失败 -1-异常
{"code":1,"failCode":0,"msg":"","type":"com.wif.monitor.action.REAL_MONITOR"}
3. 停止推流
参数
arg1: 摄像头编号
requestStopStreaming({
arg1: this.stopIpcSn,
response: (res) => {
console.log("requestStopStreaming res:" + res)
}
})
返回结果:
code: 1-操作成功 0-操作失败 -1-异常
{"code":1,"failCode":0,"msg":"","type":"com.wif.monitor.action.STOP_PUSH"}
4. 获取历史视频文件
参数
arg1: 开始时间 例如:2024-12-20 10:16:45
arg2: 结束时间 例如:2024-12-20 10:17:15
arg3: 摄像头编号(获取摄像头列表中获取) 例如:037a0002006e02ac5bfa
requestHistoryVideo({
arg1: this.startTime,
arg2: this.endTime,
arg3: this.historyIpcSn,
response: (res) => {
console.log("requestHistoryVideo res:" + res)
}
})
返回结果:
{"code":1,"msg":"/storage/ECD82C83D82C4DE0/WifIPC/037a0002006e02ac5bfa/temp/202412051451_2.mp4","type":"com.wif.monitor.action.HISTORY_MONITOR"}