...
|
...
|
@@ -86,15 +86,18 @@ public class UfoLiveService { |
|
|
|
|
|
String persistId;
|
|
|
String filePath;
|
|
|
if (configReader.getBoolean("appress.video.back.enable", false)) { //启用备份视频流
|
|
|
|
|
|
Integer cameraCode = queryInitCameraCode(req);
|
|
|
|
|
|
if (configReader.getBoolean("appress.video.back.enable" + cameraCode, false)) { //启用备份视频流
|
|
|
LOGGER.info("begin back video stream");
|
|
|
String save = qNLiveUtilBackService.fetch(queryM3u8Url(queryInitCameraCode(req), 1), req.getStartTime().longValue(), req.getEndTime().longValue());
|
|
|
String save = qNLiveUtilBackService.fetch(queryM3u8Url(cameraCode, 1), req.getStartTime().longValue(), req.getEndTime().longValue());
|
|
|
persistId = qNLiveUtilBackService.transfer(save, fileName);
|
|
|
|
|
|
filePath = QNliveConstants.LIVE_VIDEO_BACK_DOMAIN + QNliveConstants.MP4_FILEKEY_PRE + fileName + ".mp4";
|
|
|
} else {
|
|
|
LOGGER.info("begin init video stream");
|
|
|
String m3u8Url = queryM3u8Url(queryInitCameraCode(req), 0);
|
|
|
String m3u8Url = queryM3u8Url(cameraCode, 0);
|
|
|
|
|
|
qNliveUtilService.fetch(fileName, m3u8Url, String.valueOf(req.getStartTime()), String.valueOf(req.getEndTime()));
|
|
|
|
...
|
...
|
@@ -157,14 +160,14 @@ public class UfoLiveService { |
|
|
return null;
|
|
|
}
|
|
|
|
|
|
private String getVedioFileUrl(QiniuLiveRecord qiniuLiveRecord) {
|
|
|
private String getVedioFileUrl(QiniuLiveRecord qiniuLiveRecord) {
|
|
|
//http://yhb-img01.qiniudn.com/ufo/live/mp4/9817910304768_1544775266.mp4
|
|
|
if (qiniuLiveRecord.getVedioFileUrl().startsWith("http")) {
|
|
|
return qiniuLiveRecord.getVedioFileUrl();
|
|
|
}
|
|
|
|
|
|
return QNliveConstants.LIVE_VIDEO_DOMAIN + QNliveConstants.MP4_FILEKEY_PRE + qiniuLiveRecord.getVedioFileUrl();
|
|
|
}
|
|
|
return QNliveConstants.LIVE_VIDEO_DOMAIN + QNliveConstants.MP4_FILEKEY_PRE + qiniuLiveRecord.getVedioFileUrl();
|
|
|
}
|
|
|
|
|
|
// type 为1代表备用 0 代表默认的摄像源
|
|
|
public String queryM3u8Url(Integer cameraCode, int type) throws PlatformException {
|
...
|
...
|
@@ -189,7 +192,7 @@ public class UfoLiveService { |
|
|
|
|
|
// 查询当前登录用户默认的摄像头设备
|
|
|
public Integer queryInitCameraCode(QiniuLiveRecord req) {
|
|
|
// UserCameraRecord userCameraRecord = userCameraRecordMapper.selectUserCameraRecord(new UserHelper().getUserId());
|
|
|
// UserCameraRecord userCameraRecord = userCameraRecordMapper.selectUserCameraRecord(new UserHelper().getUserId());
|
|
|
|
|
|
String cameraCode = yhValueOperations.get(getRedisKey(req.getPid()));
|
|
|
|
...
|
...
|
|