接口说明
以下介绍cmsv6player.min.js插件实时视频的API接口。
使用前需要加载插件,参见:初始化插件
https可以直接对讲;http对讲时,需要下载安装PCM音频采集工具。
音频采集工具下载链接: https://v7.cmsv8.com/product/CMSV6PcmTool/CMSV6PcmTool.exe
上层通过onTtxVideoMsg消息回调来判断 type=isTalking表示正在对讲中,type=showDownLoadDialog表示需要下载pcm采集工具
开始对讲
startTalkback(jsession, devIdno, 0)
| 参数名称 | 参数类型 | 必须 | 示例 | 参数含义 |
|---|---|---|---|---|
| jsession | string | 是 | 66d754dd7f41473dbd2 | 用户登录返回的会话号 |
| devIdno | string | 是 | 013300000001 | 设备号 |
停止对讲
stopTalkback()
双向对讲回调事件
| 参数名称 | 参数含义 |
|---|---|
| showDownLoadDialog | 需要下载PCM音频采集工具 |
| isTalking | 对讲中 |
| startRecive | 开启对讲 |
| uploadRecive | 开启对讲 |
| loadRecive | 开启对讲 |
| upload | 对讲讲话 |
| uploadfull | 对讲讲话结束 |
| stopTalk | 关闭对讲 |
| reciveStreamStop | 对讲异常(网络异常等) |
| reciveNetError | 对讲异常(网络异常等) |
| reciveStreamNotFound | 对讲异常(网络异常等) |
使用示例
参见:
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
示例代码
//设置对讲参数
cmsv6player.setTalkParam(1);
//启动双向对讲
cmsv6player.startTalkback("66d754dd7f41473dbd2", "013300000001", 0);
//通过 onTtxVideoMsg 消息回调来判断 type=isTalking表示正在对讲中,type=showDownLoadDialog表示需要下载pcm采集工具
//停止对讲
cmsv6player.stopTalkback();
//对讲事件
function onTtxVideoMsg(index,type) {
if(type == "showDownLoadDialog"){
//需要下载PCM音频采集工具,非https时使用
} else if(type == "isTalking"){
//对讲中
} else if(type == "startRecive"){
//开始接收对讲数据
} else if (type == "uploadRecive") {
//开始上传对讲数据
} else if (type == "loadRecive") {
//开始加载对讲数据
} else if (type == "upload") {
//对讲声音上传中
} else if (type == "uploadfull") {
//对讲上传缓存满
} else if (type == "stopTalk") {
//关闭对讲
} else if (type == "reciveStreamStop") {
//对讲异常(音频流停止)
} else if (type == "reciveNetError") {
//对讲异常(网络异常等)
} else if (type == "reciveStreamNotFound") {
//对讲异常(网络异常等)
}
}