| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
| | | import com.genersoft.iot.vmp.media.bean.ResultForOnPublish;
|
| | | import com.genersoft.iot.vmp.media.event.*;
|
| | | import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
|
| | | import com.genersoft.iot.vmp.media.event.hook.HookType;
|
| | | import com.genersoft.iot.vmp.media.event.media.*;
|
| | | import com.genersoft.iot.vmp.media.event.mediaServer.MediaSendRtpStoppedEvent;
|
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServer;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.ZLMServerConfig;
|
| | |
| | | String mediaServerId = json.getString("mediaServerId");
|
| | | MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
| | | if (mediaServer == null) {
|
| | | return new HookResultForOnPublish(200, "success");
|
| | | return new HookResultForOnPublish(0, "success");
|
| | | }
|
| | |
|
| | | taskExecutor.execute(() -> {
|
| | | HookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_publish, json);
|
| | | if (subscribe != null) {
|
| | | subscribe.response(mediaServer, param);
|
| | | }
|
| | | });
|
| | |
|
| | | ResultForOnPublish resultForOnPublish = mediaService.authenticatePublish(mediaServer, param.getApp(), param.getStream(), param.getParams());
|
| | | if (resultForOnPublish != null) {
|
| | |
| | | public HookResult onStreamChanged(@RequestBody OnStreamChangedHookParam param) {
|
| | |
|
| | | MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId());
|
| | | if (mediaServer == null) {
|
| | | return HookResult.SUCCESS();
|
| | | }
|
| | |
|
| | | if (param.isRegist()) {
|
| | | logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
|
| | |
| | | MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId());
|
| | | if (mediaServerItem != null) {
|
| | | event.setMediaServer(mediaServerItem);
|
| | | event.setApp("rtp");
|
| | | applicationEventPublisher.publishEvent(event);
|
| | | }
|
| | | }catch (Exception e) {
|
| | | logger.info("[ZLM-HOOK-rtpServer收流超时] 发送通知失败 ", e);
|
| | | }
|
| | | taskExecutor.execute(() -> {
|
| | | List<HookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_rtp_server_timeout);
|
| | | if (subscribes != null && !subscribes.isEmpty()) {
|
| | | for (HookSubscribe.Event subscribe : subscribes) {
|
| | | subscribe.response(null, param);
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | return HookResult.SUCCESS();
|
| | | }
|
| | |
| | | public HookResult onRecordMp4(HttpServletRequest request, @RequestBody OnRecordMp4HookParam param) {
|
| | | logger.info("[ZLM HOOK] 录像完成事件:{}->{}", param.getMediaServerId(), param.getFile_path());
|
| | |
|
| | | taskExecutor.execute(() -> {
|
| | | List<HookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_record_mp4);
|
| | | if (subscribes != null && !subscribes.isEmpty()) {
|
| | | for (HookSubscribe.Event subscribe : subscribes) {
|
| | | subscribe.response(null, param);
|
| | | }
|
| | | try {
|
| | | MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId());
|
| | | if (mediaServerItem != null) {
|
| | | MediaRecordMp4Event event = MediaRecordMp4Event.getInstance(this, param, mediaServerItem);
|
| | | event.setMediaServer(mediaServerItem);
|
| | | applicationEventPublisher.publishEvent(event);
|
| | | }
|
| | | cloudRecordService.addRecord(param);
|
| | |
|
| | | });
|
| | | }catch (Exception e) {
|
| | | logger.info("[ZLM-HOOK-rtpServer收流超时] 发送通知失败 ", e);
|
| | | }
|
| | |
|
| | | return HookResult.SUCCESS();
|
| | | }
|