diff --git a/src/main/java/io/github/lunasaw/zlm/hook/controller/ZlmHookController.java b/src/main/java/io/github/lunasaw/zlm/hook/controller/ZlmHookController.java index 3e6b07f..3b06057 100644 --- a/src/main/java/io/github/lunasaw/zlm/hook/controller/ZlmHookController.java +++ b/src/main/java/io/github/lunasaw/zlm/hook/controller/ZlmHookController.java @@ -186,5 +186,11 @@ public HookResult onFlowReport(@RequestBody OnFlowReportHookParam param) { return HookResult.SUCCESS(); } + @ResponseBody + @PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8") + public HookResult onRecordMp4(@RequestBody OnRecordMp4HookParam param) { + executor.execute(() -> zlmHookService.onRecordMp4(param)); + return HookResult.SUCCESS(); + } } \ No newline at end of file diff --git a/src/main/java/io/github/lunasaw/zlm/hook/param/OnRecordMp4HookParam.java b/src/main/java/io/github/lunasaw/zlm/hook/param/OnRecordMp4HookParam.java new file mode 100644 index 0000000..df0c498 --- /dev/null +++ b/src/main/java/io/github/lunasaw/zlm/hook/param/OnRecordMp4HookParam.java @@ -0,0 +1,84 @@ +package io.github.lunasaw.zlm.hook.param; + +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.Data; + +/** + * @author weidian + * @version 1.0 + * @date 2023/12/14 + * @description: + */ +@Data +public class OnRecordMp4HookParam extends HookParam { + /** + * 流应用名 + */ + @JSONField(name = "app") + @JsonProperty("app") + private String app; + /** + * 文件名 + */ + @JSONField(name = "file_name") + @JsonProperty("file_name") + private String fileName; + /** + * + * 文件绝对路径 + */ + @JSONField(name = "file_path") + @JsonProperty("file_path") + private String filePath; + /** + * + * 文件大小,单位字节 + */ + @JSONField(name = "file_size") + @JsonProperty("file_size") + private int fileSize; + /** + * + * 文件所在目录路径 + */ + @JSONField(name = "folder") + @JsonProperty("folder") + private String folder; + /** + * + * 开始录制时间戳 + */ + @JSONField(name = "start_time") + @JsonProperty("start_time") + private int startTime; + /** + * + * 录制的流ID + */ + @JSONField(name = "stream") + @JsonProperty("stream") + private String stream; + /** + * + * 录制时长,单位秒 + */ + @JSONField(name = "time_len") + @JsonProperty("time_len") + private float timeLen; + /** + * + * http/rtsp/rtmp点播相对url路径 + */ + @JSONField(name = "url") + @JsonProperty("url") + private String url; + /** + * + * 流虚拟主机 + */ + @JSONField(name = "vhost") + @JsonProperty("vhost") + private String vhost; +} diff --git a/src/main/java/io/github/lunasaw/zlm/hook/service/AbstractZlmHookService.java b/src/main/java/io/github/lunasaw/zlm/hook/service/AbstractZlmHookService.java index b0b669a..bd4b593 100644 --- a/src/main/java/io/github/lunasaw/zlm/hook/service/AbstractZlmHookService.java +++ b/src/main/java/io/github/lunasaw/zlm/hook/service/AbstractZlmHookService.java @@ -78,4 +78,9 @@ public void onFlowReport(OnFlowReportHookParam param) { public void onServerExited(HookParam param) { } + + @Override + public void onRecordMp4(OnRecordMp4HookParam param) { + + } } diff --git a/src/main/java/io/github/lunasaw/zlm/hook/service/ZlmHookService.java b/src/main/java/io/github/lunasaw/zlm/hook/service/ZlmHookService.java index 79020ec..4e627c3 100644 --- a/src/main/java/io/github/lunasaw/zlm/hook/service/ZlmHookService.java +++ b/src/main/java/io/github/lunasaw/zlm/hook/service/ZlmHookService.java @@ -4,6 +4,8 @@ import io.github.lunasaw.zlm.hook.param.*; /** + * ... + * * @author luna * @version 1.0 * @date 2023/12/3 @@ -38,4 +40,6 @@ public interface ZlmHookService { void onFlowReport(OnFlowReportHookParam param); void onServerExited(HookParam param); + + void onRecordMp4(OnRecordMp4HookParam param); } diff --git a/zlm-spring-boot-starter-test/src/main/java/io/github/lunasaw/zlm/service/LocalZlmHookService.java b/zlm-spring-boot-starter-test/src/main/java/io/github/lunasaw/zlm/service/LocalZlmHookService.java index 9f36193..e7be1a4 100644 --- a/zlm-spring-boot-starter-test/src/main/java/io/github/lunasaw/zlm/service/LocalZlmHookService.java +++ b/zlm-spring-boot-starter-test/src/main/java/io/github/lunasaw/zlm/service/LocalZlmHookService.java @@ -88,4 +88,9 @@ public void onFlowReport(OnFlowReportHookParam param) { public void onServerExited(HookParam param) { log.info("onServerExited::param = {}", param); } + + @Override + public void onRecordMp4(OnRecordMp4HookParam param) { + log.info("onRecordMp4::param = {}", param); + } }