| | |
| | | String protocol = mediamtxConfig.isHttps() ? "https://" : "http://"; |
| | | String webrtcUrl = |
| | | protocol + mediamtxConfig.getPlayHost() + ":" + mediamtxConfig.getWebrtcPort() + "/" + ardVtdu.getName(); |
| | | |
| | | String source = ardVtdu.getRtspSource(); |
| | | Conf conf = new Conf(); |
| | | conf.setSource(ardVtdu.getRtspSource()); |
| | | if(!"publisher".equalsIgnoreCase(conf.getSource())) { |
| | | conf.setSourceOnDemand(true); |
| | | conf.setName(ardVtdu.getName()); |
| | | conf.setSource(source); |
| | | // 如果是拉流则配置按需 |
| | | if (!"publisher".equalsIgnoreCase(source)) { |
| | | conf.setSourceOnDemand(true); // 按需拉 |
| | | conf.setRunOnDemandCloseAfter("5s"); // 无观众 5 秒断开 |
| | | } |
| | | conf.setRunOnDemandRestart(false); |
| | | conf.setRunOnDemandCloseAfter("5s"); |
| | | conf.setMaxReaders(100); |
| | | conf.setSourceProtocol("tcp"); |
| | | |
| | | if (checkNameExist(ardVtdu.getName())) { |
| | | mediaClient.removePath(ardVtdu.getName()); |
| | | if (!checkNameExist(ardVtdu.getName())) { |
| | | mediaClient.addPath(ardVtdu.getName(), conf); |
| | | } else { |
| | | mediaClient.editPath(ardVtdu.getName(), conf); |
| | | } |
| | | mediaClient.addPath(ardVtdu.getName(), conf); |
| | | |
| | | ardVtdu.setCameraId(ardVtdu.getName().split("_")[0]); |
| | | ardVtdu.setRtspUrl(rtspUrl); |