parent
b3090457a4
commit
7f688f8863
|
|
@ -64,7 +64,7 @@ public class CameraController {
|
||||||
"camera_recording_start开始录像 camera_recording_stop停止录像")
|
"camera_recording_start开始录像 camera_recording_stop停止录像")
|
||||||
@RequestParam String mode) {
|
@RequestParam String mode) {
|
||||||
if (!mode.equals("camera_photo_take") && !mode.equals("camera_photo_stop") &&
|
if (!mode.equals("camera_photo_take") && !mode.equals("camera_photo_stop") &&
|
||||||
!mode.equals("camera_recording_start") && !mode.equals("camera_recording_sto")) {
|
!mode.equals("camera_recording_start") && !mode.equals("camera_recording_stop")) {
|
||||||
return new Result<>().error(ErrorCode.PARAMS_ERROR);
|
return new Result<>().error(ErrorCode.PARAMS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,8 @@ public class MediaFileDTO implements Serializable {
|
||||||
|
|
||||||
@Schema(description = "媒体数量")
|
@Schema(description = "媒体数量")
|
||||||
private Integer mediaNum;
|
private Integer mediaNum;
|
||||||
|
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
@Schema(description = "视频封面")
|
||||||
|
private String cover;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -300,8 +300,15 @@ public class FlightTaskServiceImpl extends CrudServiceImpl<FlightTaskDao, Flight
|
||||||
List<MediaFileDTO> list = mediaFileService.list(params);
|
List<MediaFileDTO> list = mediaFileService.list(params);
|
||||||
for (MediaFileDTO dto : list) {
|
for (MediaFileDTO dto : list) {
|
||||||
String objectKey = dto.getObjectKey();
|
String objectKey = dto.getObjectKey();
|
||||||
|
String subFileType = dto.getSubFileType();
|
||||||
|
if ("video".equals(subFileType)) {
|
||||||
|
dto.setUrl(BusinessConstant.VIDEO_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
||||||
|
dto.setCover(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" +
|
||||||
|
objectKey.replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX));
|
||||||
|
} else {
|
||||||
dto.setUrl(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
dto.setUrl(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -321,9 +328,11 @@ public class FlightTaskServiceImpl extends CrudServiceImpl<FlightTaskDao, Flight
|
||||||
wrapper.orderByAsc("record_date");
|
wrapper.orderByAsc("record_date");
|
||||||
List<SrsRecordEntity> list = srsService.getDao().selectList(wrapper);
|
List<SrsRecordEntity> list = srsService.getDao().selectList(wrapper);
|
||||||
for (SrsRecordEntity srsRecordEntity : list) {
|
for (SrsRecordEntity srsRecordEntity : list) {
|
||||||
|
String file = srsRecordEntity.getFile();
|
||||||
srsRecordEntity.setRecordDate(DateUtils.getBeforeHour(srsRecordEntity.getRecordDate(), 8));
|
srsRecordEntity.setRecordDate(DateUtils.getBeforeHour(srsRecordEntity.getRecordDate(), 8));
|
||||||
srsRecordEntity.setUrl(BusinessConstant.VIDEO_PATH + srsRecordEntity.getFile());
|
srsRecordEntity.setUrl(BusinessConstant.VIDEO_PATH + file);
|
||||||
srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + getVideoCover(srsRecordEntity.getFile(), srsRecordEntity.getStreamUrl()));
|
// srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + getVideoCover(srsRecordEntity.getFile(), srsRecordEntity.getStreamUrl()));
|
||||||
|
srsRecordEntity.setCover(BusinessConstant.IMAGE_PATH + file.replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -347,11 +356,11 @@ public class FlightTaskServiceImpl extends CrudServiceImpl<FlightTaskDao, Flight
|
||||||
}
|
}
|
||||||
|
|
||||||
//使用ffmpeg 用视频提取封面
|
//使用ffmpeg 用视频提取封面
|
||||||
private String getVideoCover(String file, String streamUrl) {
|
/* private String getVideoCover(String file, String streamUrl) {
|
||||||
String fileName = file.replace("live_record" + streamUrl + "/", "");
|
String fileName = file.replace("live_record" + streamUrl + "/", "");
|
||||||
String videoCoverPath = "live_record" + streamUrl + "/" + FileUtil.getPrefix(fileName) + BusinessConstant.VIDEO_COVER_SUFFIX;
|
String videoCoverPath = "live_record" + streamUrl + "/" + FileUtil.getPrefix(fileName) + BusinessConstant.VIDEO_COVER_SUFFIX;
|
||||||
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
||||||
|
|
||||||
return videoCoverPath;
|
return videoCoverPath;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,14 @@ public class MediaFileServiceImpl extends CrudServiceImpl<MediaFileDao, MediaFil
|
||||||
.filter(v -> v != null && v.getCreatedTime() != null)
|
.filter(v -> v != null && v.getCreatedTime() != null)
|
||||||
.peek(v -> {
|
.peek(v -> {
|
||||||
String objectKey = v.getObjectKey();
|
String objectKey = v.getObjectKey();
|
||||||
|
String subFileType = v.getSubFileType();
|
||||||
|
if ("video".equals(subFileType)) {
|
||||||
|
v.setUrl(BusinessConstant.VIDEO_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
||||||
|
v.setCover(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" +
|
||||||
|
objectKey.replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX));
|
||||||
|
} else {
|
||||||
v.setUrl(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
v.setUrl(BusinessConstant.IMAGE_PATH + BusinessConstant.DOCK_MEDIA_BUCKET + "/" + objectKey);
|
||||||
|
}
|
||||||
}).collect(Collectors.groupingBy(
|
}).collect(Collectors.groupingBy(
|
||||||
v -> DateUtils.format(v.getCreatedTime(), "yyyy年MM月dd日"),
|
v -> DateUtils.format(v.getCreatedTime(), "yyyy年MM月dd日"),
|
||||||
() -> new TreeMap<String, List<MediaFileDTO>>(Comparator.reverseOrder()),
|
() -> new TreeMap<String, List<MediaFileDTO>>(Comparator.reverseOrder()),
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import cn.hutool.json.JSONArray;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.multictrl.common.config.SrsConfig;
|
import com.multictrl.common.config.SrsConfig;
|
||||||
|
import com.multictrl.common.constant.BusinessConstant;
|
||||||
|
import com.multictrl.common.utils.FfmpegUtils;
|
||||||
import com.multictrl.modules.business.dao.SrsClient;
|
import com.multictrl.modules.business.dao.SrsClient;
|
||||||
import com.multictrl.modules.business.dao.SrsRecordDao;
|
import com.multictrl.modules.business.dao.SrsRecordDao;
|
||||||
import com.multictrl.modules.business.dto.SrsCallBackDTO;
|
import com.multictrl.modules.business.dto.SrsCallBackDTO;
|
||||||
|
|
@ -58,6 +60,10 @@ public class SrsServiceImpl implements SrsService {
|
||||||
if (StrUtil.isNotBlank(dateTime)) {
|
if (StrUtil.isNotBlank(dateTime)) {
|
||||||
srsRecordEntity.setRecordDate(DateUtil.parse(dateTime, "yyyy-MM-dd HH:mm:ss:SSS"));
|
srsRecordEntity.setRecordDate(DateUtil.parse(dateTime, "yyyy-MM-dd HH:mm:ss:SSS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置封面
|
||||||
|
String videoCoverPath = srsRecordEntity.getFile().replaceAll(".mp4", BusinessConstant.VIDEO_COVER_SUFFIX);
|
||||||
|
FfmpegUtils.generateVideoCover("/" + file, "/" + videoCoverPath);
|
||||||
srsRecordDao.insert(srsRecordEntity);
|
srsRecordDao.insert(srsRecordEntity);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue