diff --git a/sql/2.6.9更新.sql b/sql/2.6.9更新.sql index 769004d2..cb117b69 100644 --- a/sql/2.6.9更新.sql +++ b/sql/2.6.9更新.sql @@ -6,3 +6,19 @@ alter table wvp_platform alter table wvp_stream_proxy add stream_key varying(255) + +create table wvp_cloud_record ( + id serial primary key, + app character varying(255), + stream character varying(255), + call_id character varying(255), + start_time integer, + end_time integer, + media_server_id character varying(50), + file_name character varying(50), + folder character varying(50), + file_path character varying(255), + file_size integer, + time_len integer, + constraint uk_stream_push_app_stream_path unique (app, stream, file_path) +); diff --git a/sql/初始化.sql b/sql/初始化.sql index b95dd874..9fcbe368 100644 --- a/sql/初始化.sql +++ b/sql/初始化.sql @@ -266,6 +266,21 @@ create table wvp_stream_push ( self bool default false, constraint uk_stream_push_app_stream unique (app, stream) ); +create table wvp_cloud_record ( + id serial primary key, + app character varying(255), + stream character varying(255), + call_id character varying(255), + start_time integer, + end_time integer, + mediaServerId character varying(50), + file_name character varying(50), + folder character varying(50), + file_path character varying(255), + file_size integer, + time_len integer, + constraint uk_stream_push_app_stream_path unique (app, stream, file_path) +); create table wvp_user ( id serial primary key, diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 3c76883a..3ad7b703 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -766,6 +766,21 @@ public class ZLMHttpHookListener { return HookResult.SUCCESS(); } + /** + * 录像完成事件 + */ + @ResponseBody + @PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8") + public HookResult onRecordMp4(HttpServletRequest request, @RequestBody OnRecordMp4HookParam param) { + logger.info("[ZLM HOOK] 录像完成事件:{}->{}", param.getMediaServerId(), param.getFile_path()); + + taskExecutor.execute(() -> { + + }); + + return HookResult.SUCCESS(); + } + private Map urlParamToMap(String params) { HashMap map = new HashMap<>(); if (ObjectUtils.isEmpty(params)) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRecordMp4HookParam.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRecordMp4HookParam.java new file mode 100755 index 00000000..92bca40a --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRecordMp4HookParam.java @@ -0,0 +1,114 @@ +package com.genersoft.iot.vmp.media.zlm.dto.hook; + +/** + * zlm hook事件中的on_rtp_server_timeout事件的参数 + * @author lin + */ +public class OnRecordMp4HookParam extends HookParam{ + private String app; + private String stream; + private String file_name; + private String file_path; + private String file_size; + private String folder; + private String url; + private String vhost; + private long start_time; + private long time_len; + + public String getApp() { + return app; + } + + public void setApp(String app) { + this.app = app; + } + + public String getStream() { + return stream; + } + + public void setStream(String stream) { + this.stream = stream; + } + + public String getFile_name() { + return file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + } + + public String getFile_path() { + return file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + } + + public String getFile_size() { + return file_size; + } + + public void setFile_size(String file_size) { + this.file_size = file_size; + } + + public String getFolder() { + return folder; + } + + public void setFolder(String folder) { + this.folder = folder; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getVhost() { + return vhost; + } + + public void setVhost(String vhost) { + this.vhost = vhost; + } + + public long getStart_time() { + return start_time; + } + + public void setStart_time(long start_time) { + this.start_time = start_time; + } + + public long getTime_len() { + return time_len; + } + + public void setTime_len(long time_len) { + this.time_len = time_len; + } + + @Override + public String toString() { + return "OnRecordMp4HookParam{" + + "app='" + app + '\'' + + ", stream='" + stream + '\'' + + ", file_name='" + file_name + '\'' + + ", file_path='" + file_path + '\'' + + ", file_size='" + file_size + '\'' + + ", folder='" + folder + '\'' + + ", url='" + url + '\'' + + ", vhost='" + vhost + '\'' + + ", start_time=" + start_time + + ", time_len=" + time_len + + '}'; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java b/src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java new file mode 100755 index 00000000..3c8b9beb --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java @@ -0,0 +1,27 @@ +package com.genersoft.iot.vmp.service; + +import com.genersoft.iot.vmp.service.bean.CloudRecordItem; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +/** + * 云端录像管理 + * @author lin + */ +public interface ICloudRecordService { + + /** + * 分页回去云端录像列表 + */ + PageInfo getList(int page, int count, String startTime, String endTime); + + /** + * 获取所有的日期 + */ + List getDateList(Integer year, Integer month, String app, String stream); + + + + +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java index 8d920021..333b7b31 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java @@ -114,4 +114,5 @@ public interface IStreamPushService { * @return */ ResourceBaseInfo getOverview(); + } diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/CloudRecordItem.java b/src/main/java/com/genersoft/iot/vmp/service/bean/CloudRecordItem.java new file mode 100644 index 00000000..b374c13d --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/CloudRecordItem.java @@ -0,0 +1,175 @@ +package com.genersoft.iot.vmp.service.bean; + +/** + * 云端录像数据 + */ +public class CloudRecordItem { + /** + * 主键 + */ + private int id; + + /** + * 应用名 + */ + private String app; + + /** + * 流 + */ + private String stream; + + /** + * 健全ID + */ + private String callId; + + /** + * 开始时间 + */ + private long startTime; + + /** + * 结束时间 + */ + private long endTime; + + /** + * ZLM Id + */ + private String mediaServerId; + + /** + * 文件名称 + */ + private String fileName; + + /** + * 文件路径 + */ + private String filePath; + + /** + * 文件夹 + */ + private String folder; + + /** + * 收藏类型,收藏的文件不移除 + */ + private String collectType; + + /** + * 文件大小 + */ + private long fileSize; + + /** + * 文件时长 + */ + private long timeLen; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getApp() { + return app; + } + + public void setApp(String app) { + this.app = app; + } + + public String getStream() { + return stream; + } + + public void setStream(String stream) { + this.stream = stream; + } + + public String getCallId() { + return callId; + } + + public void setCallId(String callId) { + this.callId = callId; + } + + public long getStartTime() { + return startTime; + } + + public void setStartTime(long startTime) { + this.startTime = startTime; + } + + public long getEndTime() { + return endTime; + } + + public void setEndTime(long endTime) { + this.endTime = endTime; + } + + public String getMediaServerId() { + return mediaServerId; + } + + public void setMediaServerId(String mediaServerId) { + this.mediaServerId = mediaServerId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFolder() { + return folder; + } + + public void setFolder(String folder) { + this.folder = folder; + } + + public long getFileSize() { + return fileSize; + } + + public void setFileSize(long fileSize) { + this.fileSize = fileSize; + } + + public long getTimeLen() { + return timeLen; + } + + public void setTimeLen(long timeLen) { + this.timeLen = timeLen; + } + + public String getCollectType() { + return collectType; + } + + public void setCollectType(String collectType) { + this.collectType = collectType; + } +} diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java index 6bbb4bc3..4c149d4b 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java @@ -587,11 +587,12 @@ public class MediaServerServiceImpl implements IMediaServerService { param.put("hook.on_server_keepalive",String.format("%s/on_server_keepalive", hookPrex)); param.put("hook.on_send_rtp_stopped",String.format("%s/on_send_rtp_stopped", hookPrex)); param.put("hook.on_rtp_server_timeout",String.format("%s/on_rtp_server_timeout", hookPrex)); - if (mediaServerItem.getRecordAssistPort() > 0) { - param.put("hook.on_record_mp4",String.format("http://127.0.0.1:%s/api/record/on_record_mp4", mediaServerItem.getRecordAssistPort())); - }else { - param.put("hook.on_record_mp4",""); - } + param.put("hook.on_record_mp4",String.format("%s/on_record_mp4", hookPrex)); +// if (mediaServerItem.getRecordAssistPort() > 0) { +// param.put("hook.on_record_mp4",String.format("http://127.0.0.1:%s/api/record/on_record_mp4", mediaServerItem.getRecordAssistPort())); +// }else { +// param.put("hook.on_record_mp4",""); +// } param.put("hook.timeoutSec","20"); // 推流断开后可以在超时时间内重新连接上继续推流,这样播放器会接着播放。 // 置0关闭此特性(推流断开会导致立即断开播放器)