| | |
| | | // String app = json.getString("app");
|
| | | // String stream = json.getString("stream");
|
| | |
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
|
| | | if (subscribe != null) subscribe.response(json);
|
| | |
|
| | | JSONObject ret = new JSONObject();
|
| | |
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("ZLM HOOK on_stream_changed API调用,参数:" + json.toString());
|
| | | }
|
| | |
|
| | | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json);
|
| | | if (subscribe != null) subscribe.response(json);
|
| | |
|
| | | // 流消失移除redis play
|
| | | String app = json.getString("app");
|
| | | String streamId = json.getString("stream");
|
| | |
| | | JSONArray tracks = json.getJSONArray("tracks");
|
| | | boolean regist = json.getBoolean("regist");
|
| | | if (tracks != null) {
|
| | | System.out.println("222222" + schema);
|
| | | System.out.println("on_stream_changed->>" + schema);
|
| | | }
|
| | | if ("rtmp".equals(schema)){
|
| | |
|
| | |
| | |
|
| | | String streamId = json.getString("stream");
|
| | | String app = json.getString("app");
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | |
|
| | |
|
| | | if ("rtp".equals(app)){
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | ret.put("close", true);
|
| | | if (streamInfo != null) {
|
| | | if (redisCatchStorage.isChannelSendingRTP(streamInfo.getChannelId())) {
|
| | | StreamInfo streamInfoForPlayCatch = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | | if (streamInfoForPlayCatch != null) {
|
| | | if (redisCatchStorage.isChannelSendingRTP(streamInfoForPlayCatch.getChannelId())) {
|
| | | ret.put("close", false);
|
| | | } else {
|
| | | cmder.streamByeCmd(streamId);
|
| | | redisCatchStorage.stopPlay(streamInfo);
|
| | | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
| | | cmder.streamByeCmd(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
|
| | | redisCatchStorage.stopPlay(streamInfoForPlayCatch);
|
| | | storager.stopPlay(streamInfoForPlayCatch.getDeviceID(), streamInfoForPlayCatch.getChannelId());
|
| | | }
|
| | | }else{
|
| | | cmder.streamByeCmd(streamId);
|
| | | streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
|
| | | redisCatchStorage.stopPlayback(streamInfo);
|
| | | StreamInfo streamInfoForPlayBackCatch = redisCatchStorage.queryPlaybackByStreamId(streamId);
|
| | | if (streamInfoForPlayBackCatch != null) {
|
| | | cmder.streamByeCmd(streamInfoForPlayBackCatch.getDeviceID(), streamInfoForPlayBackCatch.getChannelId());
|
| | | redisCatchStorage.stopPlayback(streamInfoForPlayBackCatch);
|
| | | }
|
| | | }
|
| | | return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
|
| | | }else {
|
| | |
| | | String app = json.getString("app");
|
| | | String streamId = json.getString("stream");
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
|
| | | if ("rtp".equals(app) && streamId.indexOf("gb_play") > -1 && streamInfo == null) {
|
| | | if ("rtp".equals(app) && streamId.contains("gb_play") && streamInfo == null) {
|
| | | String[] s = streamId.split("_");
|
| | | if (s.length == 4) {
|
| | | String deviceId = s[2];
|