接口说明
以下介绍cmsv6player.min.js插件声音监听的API接口。支持PC/手机浏览器。
使用前需要加载插件,参见:初始化插件
开始监听
startListen(jsession, devIdno, channel)
| 参数名称 | 参数类型 | 必须 | 示例 | 参数含义 |
|---|---|---|---|---|
| jsession | string | 是 | 66d754dd7f41473dbd2 | 用户登录返回的会话号 |
| devIdno | string | 是 | 013300000001 | 设备号 |
| channel | number | 是 | 0 | 设备通道(从0开始) |
停止监听
stopListen()
| 参数名称 | 参数类型 | 必须 | 示例 | 参数含义 |
|---|---|---|---|---|
| 无 | 无 | 无 | 无 | 无 |
监听回调事件
参数类型定义
| 参数名称 | 参数含义 |
|---|---|
| startListen | 开始监听 |
| stopListen | 停止监听 |
| listenNetError | 网络异常 |
| playListen | 监听中 |
| loadListen | 等待请求监听 |
| listenStreamNotFound | 等待请求监听 |
| listenStreamStop | 等待请求监听 |
使用示例
PlateNum: 车牌号
参见:https://v7.cmsv8.com/808gps/open/player/video-demo.html
https://v7.cmsv8.com/808gps/open/player/videoExampleH5.html?lang=zh
https://v7.cmsv8.com/808gps/open/player/RealPlayVideo.html?account=cmsv6&password=cmsv6&PlateNum=S66666&lang=zh
https://v7.cmsv8.com/808gps/open/player/RealPlayVideo.html?jsession=66d754dd7f41473dbd2&PlateNum=S66666&lang=zh
示例代码
//要初始化完成后才能调用
//开始监听
function startMonitor() {
//开始监听
cmsv6player.startListen("66d754dd7f41473dbd2", "devIdno", 0);
}
//停止监听
function stopMonitor() {
cmsv6player.stopListen();
}
//视频回调事件---视频插件直接调用onTtxVideoMsg接口
function onTtxVideoMsg(index,type) {
if(type == "startListen"){
//开始监听
} else if (type == "stopListen") {
//停止监听
} else if (type == "listenNetError") {
//网络异常
} else if (type == "playListen") {
//监听中
} else if (type == "loadListen") {
//加载监听中
} else if (type == "listenStreamNotFound") {
//没有相应的声音监听流
} else if (type == "listenStreamStop") {
//声音监听停止
}
}