通过设备id获取摄像头的播放地址,当摄像头为多目时,会返回多个地址。
https://open.eye4cloud.com/{{open_id}}/open/v1/device/getWebrtcAddress| 字段名 | 是否必填 | 类型 | 备注 |
|---|---|---|---|
| device_id | 是 | string | 摄像机唯一id |
| password | 是 | string | 设备密码,如果不传则使用开放平台注册时的密码进行校验,如果未注册到开放平台需要先注册到开放平台 |
| timestamp | 是 | int64 | 时间戳,单位:秒 |
| nonce | 是 | string | 随机字符串,8~20个字符 |
| sign | 是 | string | 具体实现方法,请参考《生成sign的示例代码》 生成sign时data字段可不传值 |
| data | 否 | string | 设备DATA,可传空字符串 |
| imei | 否 | string | 设备IMEI,可传空字符串 |
| media | 否 | int | 指定流媒体服务器, 不传或传0表示电信服务器, 3表示移动服务器 |
{
"device_id": "xxx",
"timestamp": 1755685731,
"nonce": "dask43hfad",
"sign": "xxxxxxx",
}
curl 'https://open.eye4cloud.com/xxxxx/open/v1/device/getWebrtcAddress' \
-H 'Content-Type: application/json' \
--data-raw '{
"device_id": "xxx",
"timestamp": 1757472185,
"nonce": "",
"sign": "",
}'
| 字段名 | 类型 | 备注 |
|---|---|---|
| error_code | int | 状态码:0正常,其他异常 |
| error_message | string | 错误信息:正常为success |
| data | object | 推流地址列表(单目只有一个,多目会有多个地址) |
| data.list | array | webrtc播放地址列表(多目存在多个) |
| data.backup_list | array | 备用播放地址 |
示例:
{
"error_code": 0,
"error_message": "success",
"error_tips": "",
"data": {
"list": [
"https://example.com/DEMO_RESOURCE&nonce=&sign=&stream=DEMO_STREAM_001×tamp=&type=play&vp_openid=" ,
"https://example.com/DEMO_RESOURCE&nonce=&sign=&stream=DEMO_STREAM_001×tamp=&type=play&vp_openid="
],
"backup_list": [
"https://example.com/DEMO_RESOURCE&nonce=&sign=&stream=DEMO_STREAM_001×tamp=&type=play&vp_openid=" ,
"https://example.com/DEMO_RESOURCE&nonce=&sign=&stream=DEMO_STREAM_001×tamp=&type=play&vp_openid="
]
}
}