|
|
@@ -107,21 +107,27 @@ public class PlayController {
|
|
|
String deviceStr[] = deviceIds.split(",");
|
|
|
List<String> deviceList = Arrays.asList(deviceStr);
|
|
|
List<DeviceChannel> deviceChannelList = playService.queryChannelByDeviceId(deviceList, page, count);
|
|
|
- for (DeviceChannel deviceChannel : deviceChannelList) {
|
|
|
- // 获取可用的zlm
|
|
|
- Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
|
|
|
- MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
|
|
|
- PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
|
|
|
- DeferredResult<ResponseEntity<String>> result=playResult.getResult();
|
|
|
- ResponseEntity responseEntity = (ResponseEntity)result.getResult();
|
|
|
- if(responseEntity != null && responseEntity.getStatusCode()==HttpStatus.OK){
|
|
|
- WVPResult wvpResult = (WVPResult)responseEntity.getBody();
|
|
|
- if (wvpResult.getCode() == 0) {
|
|
|
- StreamInfo streamInfo = (StreamInfo)wvpResult.getData();
|
|
|
- list.add(streamInfo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ if (deviceChannelList != null && deviceChannelList.size() > 0) {
|
|
|
+ for (DeviceChannel deviceChannel : deviceChannelList) {
|
|
|
+ // 获取可用的zlm
|
|
|
+ Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
|
|
|
+ MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
|
|
|
+ PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
|
|
|
+ if (playResult != null && playResult.getResult() != null) {
|
|
|
+ DeferredResult<ResponseEntity<String>> result = playResult.getResult();
|
|
|
+ if (result != null && result.getResult() != null) {
|
|
|
+ ResponseEntity responseEntity = (ResponseEntity) result.getResult();
|
|
|
+ if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
|
|
|
+ WVPResult wvpResult = (WVPResult) responseEntity.getBody();
|
|
|
+ if (wvpResult.getCode() == 0) {
|
|
|
+ StreamInfo streamInfo = (StreamInfo) wvpResult.getData();
|
|
|
+ list.add(streamInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("code", "200");
|
|
|
map.put("msg", "成功!");
|