|
|
@ -39,10 +39,6 @@ public class VideoServiceImpl implements VideoService { |
|
|
|
|
|
|
|
private final ObjectMapper mapper = new ObjectMapper(); |
|
|
|
|
|
|
|
public VideoServiceImpl() throws ClientException { |
|
|
|
iClient = new DefaultClient(host, username, password, clientId, clientSecret); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取设备通道列表 |
|
|
|
* |
|
|
@ -78,6 +74,7 @@ public class VideoServiceImpl implements VideoService { |
|
|
|
log.error("设备通道列表为空"); |
|
|
|
channelList = Collections.emptyList(); |
|
|
|
} |
|
|
|
iClient = null; |
|
|
|
return channelList; |
|
|
|
} |
|
|
|
|
|
|
@ -130,6 +127,9 @@ public class VideoServiceImpl implements VideoService { |
|
|
|
realtimeBody = String.format(realtimeBody, channelCode, streamType, type); |
|
|
|
log.info("请求参数:{}", realtimeBody); |
|
|
|
realtimeRequest.body(realtimeBody); |
|
|
|
if (null == iClient) { |
|
|
|
iClient = new DefaultClient(host, username, password, clientId, clientSecret); |
|
|
|
} |
|
|
|
String realtimeResponse = iClient.doAction(realtimeRequest); |
|
|
|
String url = null; |
|
|
|
try { |
|
|
@ -143,6 +143,8 @@ public class VideoServiceImpl implements VideoService { |
|
|
|
throw new RuntimeException("response format error"); |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} finally { |
|
|
|
iClient = null; |
|
|
|
} |
|
|
|
return url; |
|
|
|
} |
|
|
|