开始重构云端录像

pull/1242/head
648540858 2023-10-12 18:34:16 +08:00
parent 78f628dd6f
commit 298a9f4280
8 changed files with 369 additions and 5 deletions

View File

@ -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)
);

View File

@ -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,

View File

@ -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<String, String> urlParamToMap(String params) {
HashMap<String, String> map = new HashMap<>();
if (ObjectUtils.isEmpty(params)) {

View File

@ -0,0 +1,114 @@
package com.genersoft.iot.vmp.media.zlm.dto.hook;
/**
* zlm hookon_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 +
'}';
}
}

View File

@ -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<CloudRecordItem> getList(int page, int count, String startTime, String endTime);
/**
*
*/
List<String> getDateList(Integer year, Integer month, String app, String stream);
}

View File

@ -114,4 +114,5 @@ public interface IStreamPushService {
* @return
*/
ResourceBaseInfo getOverview();
}

View File

@ -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;
}
}

View File

@ -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关闭此特性(推流断开会导致立即断开播放器)