| | |
| | | @Slf4j(topic = "vtdu") |
| | | @Order(2) |
| | | public class MediaServiceImpl implements IMediaService, ApplicationRunner { |
| | | private static List<String> mediaNameList = new ArrayList<>(); |
| | | public static List<String> mediaNameList = new ArrayList<>(); |
| | | @Resource |
| | | MediaClient mediaClient; |
| | | |
| | |
| | | |
| | | if (!checkNameExist(name)) { |
| | | mediaClient.addPath(name, conf); |
| | | mediaNameList.add(name); |
| | | } |
| | | |
| | | map.put("rtspUrl", rtspUrl); |
| | |
| | | try { |
| | | if (checkNameExist(name)) { |
| | | mediaClient.removePath(name); |
| | | mediaNameList.remove(name); |
| | | } |
| | | } catch (ForestRuntimeException ex) { |
| | | log.error("移除流媒体异常:" + ex.getMessage()); |
| | |
| | | */ |
| | | @Override |
| | | public List<String> getNameList() { |
| | | List<String> nameList = new ArrayList<>(); |
| | | try { |
| | | String paths = mediaClient.paths(); |
| | | JsonsRoot jsonsRoot = JSONObject.parseObject(paths, JsonsRoot.class); |
| | | List<Items> items = jsonsRoot.getItems(); |
| | | for (Items item : items) { |
| | | nameList.add(item.getName()); |
| | | mediaNameList.add(item.getName()); |
| | | } |
| | | } catch (ForestNetworkException ex) { |
| | | log.error("获取流媒体name列表异常:" + ex.getMessage()); |
| | | } catch (ForestRuntimeException ex) { |
| | | log.error("获取流媒体name列表异常:" + ex.getMessage()); |
| | | } |
| | | return nameList; |
| | | return mediaNameList; |
| | | } |
| | | |
| | | /** |