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