| | |
| | | package com.genersoft.iot.vmp.media.zlm; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| | |
| | | jsonObject.put("app", streamPushItem.getApp()); |
| | | jsonObject.put("stream", streamPushItem.getStream()); |
| | | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{ |
| | | System.out.println(1222211111); |
| | | updateMedia(response.getString("app"), response.getString("stream")); |
| | | }); |
| | | } |
| | |
| | | storager.mediaOutline(app, streamId); |
| | | } |
| | | } |
| | | |
| | | public void clearAllSessions() { |
| | | logger.info("清空所有国标相关的session"); |
| | | JSONObject allSessionJSON = zlmresTfulUtils.getAllSession(); |
| | | ZLMServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| | | HashSet<String> allLocalPorts = new HashSet(); |
| | | if (allSessionJSON.getInteger("code") == 0) { |
| | | JSONArray data = allSessionJSON.getJSONArray("data"); |
| | | if (data.size() > 0) { |
| | | for (int i = 0; i < data.size(); i++) { |
| | | JSONObject sessionJOSN = data.getJSONObject(i); |
| | | Integer local_port = sessionJOSN.getInteger("local_port"); |
| | | if (!local_port.equals(Integer.valueOf(mediaInfo.getHttpPort())) && |
| | | !local_port.equals(Integer.valueOf(mediaInfo.getHttpSSLport())) && |
| | | !local_port.equals(Integer.valueOf(mediaInfo.getRtmpPort())) && |
| | | !local_port.equals(Integer.valueOf(mediaInfo.getRtspPort())) && |
| | | !local_port.equals(Integer.valueOf(mediaInfo.getRtspSSlport())) && |
| | | !local_port.equals(Integer.valueOf(mediaInfo.getHookOnFlowReport()))){ |
| | | allLocalPorts.add(sessionJOSN.getInteger("local_port") + ""); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (allLocalPorts.size() > 0) { |
| | | List<String> result = new ArrayList<>(allLocalPorts); |
| | | String localPortSStr = String.join(",", result); |
| | | zlmresTfulUtils.kickSessions(localPortSStr); |
| | | } |
| | | } |
| | | } |