| | |
| | | @Autowired
|
| | | private MediaConfig mediaConfig;
|
| | |
|
| | | @Autowired
|
| | | private ZLMRESTfulUtils zlmresTfulUtils;
|
| | |
|
| | | /**
|
| | | * 服务器定时上报时间,上报间隔可配置,默认10s上报一次
|
| | | *
|
| | |
| | | streamProxyService.del(app, streamId);
|
| | | String url = streamProxyItem.getUrl() != null?streamProxyItem.getUrl():streamProxyItem.getSrc_url();
|
| | | logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", app, streamId, url);
|
| | |
|
| | | }else if (streamProxyItem != null && streamProxyItem.isEnable()) {
|
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
| | | if(null!=mediaServerItem){
|
| | | JSONObject jsonObject = zlmresTfulUtils.closeStreams(mediaServerItem,streamProxyItem.getApp(), streamProxyItem.getStream());
|
| | | if (jsonObject.getInteger("code") == 0) {
|
| | | streamProxyItem.setEnable(false);
|
| | | storager.updateStreamProxy(streamProxyItem);
|
| | | }
|
| | | }else {
|
| | | ret.put("close", false);
|
| | | }
|
| | | }else {
|
| | | ret.put("close", false);
|
| | | }
|
| | |
| | | }
|
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
| | | if (userSetup.isAutoApplyPlay() && mediaInfo != null) {
|
| | | if (userSetup.isAutoApplyPlay() && mediaInfo != null && mediaInfo.isRtpEnable()) {
|
| | | String app = json.getString("app");
|
| | | String streamId = json.getString("stream");
|
| | | if ("rtp".equals(app)) {
|
| | |
| | | String channelId = s[1];
|
| | | Device device = redisCatchStorage.getDevice(deviceId);
|
| | | if (device != null) {
|
| | | UUID uuid = UUID.randomUUID();
|
| | | SSRCInfo ssrcInfo;
|
| | | String streamId2 = null;
|
| | | if (mediaInfo.isRtpEnable()) {
|
| | | streamId2 = String.format("%s_%s", device.getDeviceId(), channelId);
|
| | | }
|
| | | ssrcInfo = mediaServerService.openRTPServer(mediaInfo, streamId2);
|
| | | cmder.playStreamCmd(mediaInfo, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> {
|
| | | logger.info("收到订阅消息: " + response.toJSONString());
|
| | | playService.onPublishHandlerForPlay(mediaServerItemInuse, response, deviceId, channelId, uuid.toString());
|
| | | }, null);
|
| | | playService.play(mediaInfo,deviceId, channelId, null, null, null);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | ret.put("msg", "success");
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | return new ResponseEntity<>(ret.toString(),HttpStatus.OK);
|
| | | }
|
| | |
|
| | | /**
|