| | |
| | | * STEP5:组装请求参数 |
| | | */ |
| | | JSONObject jsonBody = new JSONObject(); |
| | | jsonBody.put("cameraIndexCode", cameraIndexCode); |
| | | jsonBody.put("indexCode", cameraIndexCode); |
| | | jsonBody.put("streamType", 0); |
| | | jsonBody.put("netZoneCode", 0); |
| | | jsonBody.put("protocol", protocol); |
| | | jsonBody.put("transmode", 1); |
| | | jsonBody.put("expand", "streamform=ps"); |
| | | jsonBody.put("expireTime", 300); |
| | | String body = jsonBody.toJSONString(); |
| | | |
| | | |
| | | // JSONObject jsonBody = new JSONObject(); |
| | | // jsonBody.put("cameraIndexCode", cameraIndexCode); |
| | | // jsonBody.put("streamType", 0); |
| | | // jsonBody.put("protocol", protocol); |
| | | // jsonBody.put("transmode", 1); |
| | | // jsonBody.put("expand", "streamform=ps"); |
| | | // String body = jsonBody.toJSONString(); |
| | | |
| | | |
| | | /** |
| | | * STEP6:调用接口 |
| | | */ |
| | |
| | | |
| | | String result = GetCameraResourcePage(1, 1, HkConstant.cameras); |
| | | //根据设备id获取设备编号 |
| | | String result1 = QueryCameraPreviewURL(HkConstant.camerasID, "111111", "encodeDevice", "deviceCode"); |
| | | String result1 = QueryCameraPreviewURL(HkConstant.camerasID, "111111222", "encodeDevice", "deviceCode"); |
| | | |
| | | JSONObject jsonObject1 = JSONObject.parseObject(result1); |
| | | JSONObject res1 = (JSONObject) jsonObject1.get("data"); |
| | |
| | | JSONArray arr2 = JSON.parseArray(res2.getString("list")); |
| | | JSONObject data2 = (JSONObject) arr2.get(0); |
| | | String code2 = data2.get("indexCode").toString(); |
| | | |
| | | //根据子节点编号获取设备播放地址 |
| | | String result3 = GetCameraPreviewURL(HkConstant.previewURLs, code2, ProtocolConstant.HLS); |
| | | String result3 = GetCameraPreviewURL(HkConstant.previewURLshttps, code2, ProtocolConstant.HLSS); |
| | | //根据子节点编号获取音频对讲地址 |
| | | String result4 = GetTalkURLs(HkConstant.talkURLs, code2); |
| | | |