Skip to content

Commit

Permalink
📦 hook sevice onRecordMp4
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhangyue committed Dec 14, 2023
1 parent 0f9588c commit 11ea9a2
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,9 @@ public void onFlowReport(OnFlowReportHookParam param) {
public void onServerExited(HookParam param) {

}

@Override
public void onRecordMp4(OnRecordMp4HookParam param) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import io.github.lunasaw.zlm.hook.param.*;

/**
* <a href="https://github.com/zlmediakit/ZLMediaKit/wiki/MediaServer%E6%94%AF%E6%8C%81%E7%9A%84HTTP-HOOK-API">...</a>
*
* @author luna
* @version 1.0
* @date 2023/12/3
Expand Down Expand Up @@ -38,4 +40,6 @@ public interface ZlmHookService {
void onFlowReport(OnFlowReportHookParam param);

void onServerExited(HookParam param);

void onRecordMp4(OnRecordMp4HookParam param);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 11ea9a2

Please sign in to comment.