| | |
| | | package com.genersoft.iot.vmp.media.zlm; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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; |
| | |
| | | @Autowired |
| | | private IStreamPushService streamPushService; |
| | | |
| | | @Autowired |
| | | private ZLMHttpHookSubscribe subscribe; |
| | | |
| | | |
| | | public void updateMediaList() { |
| | | storager.clearMediaList(); |
| | |
| | | |
| | | if (streamPushItems != null) { |
| | | storager.updateMediaList(streamPushItems); |
| | | for (StreamPushItem streamPushItem : streamPushItems) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | 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")); |
| | | }); |
| | | } |
| | | } |
| | | })); |
| | | |
| | |
| | | |
| | | public void addMedia(String app, String streamId) { |
| | | //使用异步更新推流 |
| | | updateMedia(app, streamId); |
| | | } |
| | | |
| | | |
| | | public void updateMedia(String app, String streamId) { |
| | | //使用异步更新推流 |
| | | zlmresTfulUtils.getMediaList(app, streamId, "rtmp", json->{ |
| | | |
| | | if (json == null) return; |