| | |
| | | |
| | | import com.ard.common.constant.HttpStatus; |
| | | import com.ard.common.core.page.TableDataInfo; |
| | | import com.ard.tianyu.model.receiver.BoxReceiver; |
| | | import com.ard.tianyu.model.receiver.PullStreamUrlReceiver; |
| | | import com.ard.tianyu.config.TyConfiguration; |
| | | import com.ard.tianyu.model.cache.TyTcpServerCache; |
| | | import com.ard.tianyu.model.receiver.BoxInfoReceiver; |
| | | import com.ard.tianyu.model.receiver.BoxStreamUrlReceiver; |
| | | import com.ard.tianyu.service.ITyService; |
| | | import com.ard.vtdu.client.MediaClient; |
| | | import com.ard.vtdu.domain.*; |
| | |
| | | private MediaClient mediaClient; |
| | | @Resource |
| | | private ITyService tyService; |
| | | @Resource |
| | | private TyConfiguration tyConfiguration; |
| | | @Value("${mediamtx.host}") |
| | | private String mediamtxHost; |
| | | |
| | |
| | | return mediaClient.getPathConfigs(pageNum - 1, pageSize); |
| | | } |
| | | |
| | | //同步无人机推流到流媒体 |
| | | @Scheduled(cron = "0/20 * * * * ?") |
| | | //同步无人机推流到流媒体(流量的关系 不能持续拉流 关闭定时同步任务) |
| | | // @Scheduled(cron = "0/20 * * * * ?") |
| | | public void syncVtdu() { |
| | | if (!TyTcpServerCache.getTcpServerCache(tyConfiguration.getTcpserver() + ":" + tyConfiguration.getTcpport())) { |
| | | return; |
| | | } |
| | | log.info("定时同步MediaMTX任务开始"); |
| | | List<String> nameList = getNameList(); |
| | | List<BoxReceiver> boxList = tyService.getBoxList(); |
| | | List<BoxInfoReceiver> boxList = tyService.getBoxList(); |
| | | if (boxList == null || boxList.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ArdVtdu> ardVtduList = boxList.stream() |
| | | .filter(boxReceiver -> boxReceiver.getOnLine() != 0) // 过滤掉不在线的 |
| | | .map(boxReceiver -> { |
| | | PullStreamUrlReceiver boxLiveUrl = tyService.getBoxLiveUrl(boxReceiver.getBoxSn()); |
| | | BoxStreamUrlReceiver boxLiveUrl = tyService.getBoxLiveUrl(boxReceiver.getBoxSn()); |
| | | return ArdVtdu.builder().name(boxReceiver.getBoxSn()).rtspSource(boxLiveUrl.getRtmp()).build(); |
| | | }) |
| | | .collect(Collectors.toList()); |