Commit bbf8ab93109cd5b4e2efaf96a6db12a11b55f3f8

Authored by WuPeng
1 parent 95642d0b

添加on_record_ts事件支持

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -248,6 +248,23 @@ public class ZLMHttpHookListener {
248 248 ret.put("msg", "success");
249 249 return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
250 250 }
  251 + /**
  252 + * 录制hls完成后通知事件;此事件对回复不敏感。
  253 + *
  254 + */
  255 + @ResponseBody
  256 + @PostMapping(value = "/on_record_ts", produces = "application/json;charset=UTF-8")
  257 + public ResponseEntity<String> onRecordTs(@RequestBody JSONObject json){
  258 +
  259 + if (logger.isDebugEnabled()) {
  260 + logger.debug("[ ZLM HOOK ]on_record_ts API调用,参数:" + json.toString());
  261 + }
  262 + String mediaServerId = json.getString("mediaServerId");
  263 + JSONObject ret = new JSONObject();
  264 + ret.put("code", 0);
  265 + ret.put("msg", "success");
  266 + return new ResponseEntity<String>(ret.toString(),HttpStatus.OK);
  267 + }
251 268  
252 269 /**
253 270 * rtsp专用的鉴权事件,先触发on_rtsp_realm事件然后才会触发on_rtsp_auth事件。
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
... ... @@ -495,14 +495,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
495 495 param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline
496 496 param.put("ffmpeg.cmd","%s -fflags nobuffer -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
497 497 param.put("hook.enable","1");
498   - param.put("hook.on_flow_report","");
  498 + param.put("hook.on_flow_report",String.format("%s/on_flow_report", hookPrex));
499 499 param.put("hook.on_play",String.format("%s/on_play", hookPrex));
500   - param.put("hook.on_http_access","");
  500 + param.put("hook.on_http_access",String.format("%s/on_http_access", hookPrex));
501 501 param.put("hook.on_publish", String.format("%s/on_publish", hookPrex));
502 502 param.put("hook.on_record_mp4",recordHookPrex != null? String.format("%s/on_record_mp4", recordHookPrex): "");
503   - param.put("hook.on_record_ts","");
504   - param.put("hook.on_rtsp_auth","");
505   - param.put("hook.on_rtsp_realm","");
  503 + param.put("hook.on_record_ts",String.format("%s/on_record_ts", hookPrex));
  504 + param.put("hook.on_rtsp_auth",String.format("%s/on_rtsp_auth", hookPrex));
  505 + param.put("hook.on_rtsp_realm",String.format("%s/on_rtsp_realm", hookPrex));
506 506 param.put("hook.on_server_started",String.format("%s/on_server_started", hookPrex));
507 507 param.put("hook.on_shell_login",String.format("%s/on_shell_login", hookPrex));
508 508 param.put("hook.on_stream_changed",String.format("%s/on_stream_changed", hookPrex));
... ...