|
|
@@ -74,14 +74,12 @@ public class PlayController {
|
|
|
@Autowired
|
|
|
private DeviceChannelMapper deviceChannelMapper;
|
|
|
|
|
|
- @ApiOperation("开始点播")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
|
|
- @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
|
|
- })
|
|
|
- @GetMapping("/start/{deviceId}/{channelId}")
|
|
|
- public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId,
|
|
|
- @PathVariable String channelId) {
|
|
|
+ @ApiOperation("开始点播")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
|
|
+ @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class)})
|
|
|
+ @GetMapping("/start/{deviceId}/{channelId}")
|
|
|
+ public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, @PathVariable String channelId) {
|
|
|
|
|
|
// 获取可用的zlm
|
|
|
Device device = storager.queryVideoDevice(deviceId);
|
|
|
@@ -91,47 +89,51 @@ public class PlayController {
|
|
|
return playResult.getResult();
|
|
|
}
|
|
|
|
|
|
- @ApiOperation("带分页批量点播")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "deviceIds", value = "设备ID", dataTypeClass = String.class,allowMultiple = true),
|
|
|
- @ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
|
|
- @ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
|
|
- })
|
|
|
- @GetMapping("/startList")
|
|
|
- public Map<String,Object> play(String deviceIds, int page, int count) {
|
|
|
- if(StringUtils.isEmpty(deviceIds)){
|
|
|
- Map<String,Object> map=new HashMap<>();
|
|
|
- map.put("code","500");
|
|
|
- map.put("msg","设备编号不能为空!");
|
|
|
- map.put("data",null);
|
|
|
- return map;
|
|
|
- }
|
|
|
- List<DeferredResult<ResponseEntity<String>>> list=new ArrayList<DeferredResult<ResponseEntity<String>>>();
|
|
|
- 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);
|
|
|
- list.add(playResult.getResult());
|
|
|
- }
|
|
|
- Map<String,Object> map=new HashMap<>();
|
|
|
- map.put("code","200");
|
|
|
- map.put("msg","成功!");
|
|
|
- map.put("data",list);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation("停止点播")
|
|
|
- @ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class),
|
|
|
- @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class),
|
|
|
- })
|
|
|
- @GetMapping("/stop/{deviceId}/{channelId}")
|
|
|
- public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) {
|
|
|
+ @ApiOperation("带分页批量点播")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "deviceIds", value = "设备ID", dataTypeClass = String.class, allowMultiple = true),
|
|
|
+ @ApiImplicitParam(name = "page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
|
|
+ @ApiImplicitParam(name = "count", value = "每页查询数量", required = true, dataTypeClass = Integer.class)})
|
|
|
+ @GetMapping("/startList")
|
|
|
+ public Map<String, Object> play(String deviceIds, int page, int count) {
|
|
|
+ if (deviceIds==null || ("").equals(deviceIds)) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("code", "500");
|
|
|
+ map.put("msg", "设备编号不能为空!");
|
|
|
+ map.put("data", null);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ List<StreamInfo> list = new ArrayList<>();
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("code", "200");
|
|
|
+ map.put("msg", "成功!");
|
|
|
+ map.put("data", list);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("停止点播")
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class)})
|
|
|
+ @GetMapping("/stop/{deviceId}/{channelId}")
|
|
|
+ public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) {
|
|
|
|
|
|
logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId ));
|
|
|
|