|
@@ -108,6 +108,28 @@ public class ContentServiceImpl implements ContentService {
|
|
|
}
|
|
|
param.setPipelineId(videoAnalysePipelineId);
|
|
|
pipelineService.execute(param);
|
|
|
+ try {
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ Long videoId = param.getVideoId();
|
|
|
+ String content = param.getContent();
|
|
|
+ SubmitTasksParam submitTasksParam = new SubmitTasksParam();
|
|
|
+ List<ContentDTO> contentDTOList = new ArrayList<>();
|
|
|
+ ContentDTO contentDTO = new ContentDTO();
|
|
|
+ contentDTO.setVideoId(videoId);
|
|
|
+ contentDTO.setContentType(ContentTypeEnum.VIDEO.getValue());
|
|
|
+ contentDTO.setContent(content);
|
|
|
+ contentDTO.setPipelineId(videoAnalysePipelineId);
|
|
|
+ Map<String, Object> extMap = new HashMap<>();
|
|
|
+ extMap.put("pipelineId", videoAnalysePipelineId);
|
|
|
+ extMap.put("type", "");
|
|
|
+ extMap.put("video_url", content);
|
|
|
+ contentDTO.setExtMap(extMap);
|
|
|
+ contentDTOList.add(contentDTO);
|
|
|
+ submitTasksParam.setContents(contentDTOList);
|
|
|
+ TaskResultVO taskResultVO = submitTasks(submitTasksParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -389,6 +411,7 @@ public class ContentServiceImpl implements ContentService {
|
|
|
private String getVideoUrl(Long videoId) {
|
|
|
//获取多码率
|
|
|
String videoUrl = null;
|
|
|
+ boolean isM3u8 = false;
|
|
|
WxVideoTranscodeExample transcodeExample = new WxVideoTranscodeExample();
|
|
|
transcodeExample.createCriteria().andVideoIdEqualTo(videoId).andTransChannelEqualTo(TRANSCODE_CHANNEL)
|
|
|
.andTranscodeStatusEqualTo(3);
|
|
@@ -397,11 +420,14 @@ public class ContentServiceImpl implements ContentService {
|
|
|
WxVideoTranscode wxVideoTranscode = transcodeList.get(0);
|
|
|
String transcodeVideoPath = wxVideoTranscode.getTranscodeVideoPath();
|
|
|
if (Objects.nonNull(transcodeVideoPath)) {
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.MULTI_CDN_HTTP_DOMAIN, transcodeVideoPath);
|
|
|
+ isM3u8 = UrlUtil.isM3u8ByExtension(transcodeVideoPath);
|
|
|
+ if (!isM3u8) {
|
|
|
+ videoUrl = UrlUtil.processUrl(Constant.MULTI_CDN_HTTP_DOMAIN, transcodeVideoPath);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//没有多码率文件
|
|
|
- if (Objects.isNull(videoUrl)) {
|
|
|
+ if (Objects.isNull(videoUrl) && !isM3u8) {
|
|
|
WxVideo wxVideo = wxVideoMapper.selectByPrimaryKey(videoId);
|
|
|
if (Objects.isNull(wxVideo)) {
|
|
|
XxlJobLogger.log("table = {} videoId = {} wxVideo is null", topReturnTable, videoId);
|
|
@@ -411,42 +437,45 @@ public class ContentServiceImpl implements ContentService {
|
|
|
if (Objects.nonNull(transedVideoPath) && !transedVideoPath.isEmpty()) {
|
|
|
ObjectMetadata objectMetadata = aliyunOssManager.getObjectMetadata(TRANSCODE_BUCKET, transedVideoPath);
|
|
|
if (Objects.nonNull(objectMetadata)) {
|
|
|
- videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, transedVideoPath);
|
|
|
- boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
- boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.DeepColdArchive);
|
|
|
- if (isCodeArchive || isDeepColdArchive) {
|
|
|
- try {
|
|
|
- //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
- if (objectMetadata.isRestoreCompleted()) {
|
|
|
- //解冻完成
|
|
|
- return videoUrl;
|
|
|
+ isM3u8 = UrlUtil.isM3u8ByExtension(transedVideoPath);
|
|
|
+ if (!isM3u8) {
|
|
|
+ videoUrl = UrlUtil.processUrl(Constant.VIDEO_CDN_HTTP_DOMAIN, transedVideoPath);
|
|
|
+ boolean isCodeArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.ColdArchive);
|
|
|
+ boolean isDeepColdArchive = Objects.equals(objectMetadata.getObjectStorageClass(), StorageClass.DeepColdArchive);
|
|
|
+ if (isCodeArchive || isDeepColdArchive) {
|
|
|
+ try {
|
|
|
+ //throw NPE 未解冻 true 解冻完成 false 解冻中
|
|
|
+ if (objectMetadata.isRestoreCompleted()) {
|
|
|
+ //解冻完成
|
|
|
+ return videoUrl;
|
|
|
+ } else {
|
|
|
+ //解冻中
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ //未开始解冻
|
|
|
+ log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
+ }
|
|
|
+ //解冻
|
|
|
+ aliyunOssManager.restoreObject(TRANSCODE_BUCKET, transedVideoPath, EXPIRE_DAYS);
|
|
|
+ Map<String, Object> messageMap = new HashMap<>();
|
|
|
+ messageMap.put("videoId", videoId);
|
|
|
+ Duration duration;
|
|
|
+ if (isCodeArchive) {
|
|
|
+ duration = Duration.ofHours(1);
|
|
|
} else {
|
|
|
- //解冻中
|
|
|
- return null;
|
|
|
+ duration = Duration.ofHours(12);
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- //未开始解冻
|
|
|
- log.error("{} {} not restoreObject", videoId, videoUrl);
|
|
|
- }
|
|
|
- //解冻
|
|
|
- aliyunOssManager.restoreObject(TRANSCODE_BUCKET, transedVideoPath, EXPIRE_DAYS);
|
|
|
- Map<String, Object> messageMap = new HashMap<>();
|
|
|
- messageMap.put("videoId", videoId);
|
|
|
- Duration duration;
|
|
|
- if (isCodeArchive) {
|
|
|
- duration = Duration.ofHours(1);
|
|
|
+ try {
|
|
|
+ MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
+ log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
} else {
|
|
|
- duration = Duration.ofHours(12);
|
|
|
- }
|
|
|
- try {
|
|
|
- MessageId messageId = oldVersionRemainVideoUnderstandingProducer.syncSendDelayMessage(messageMap, duration);
|
|
|
- log.info("syncSendDelayMessage messageId = {}", messageId);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("syncSendDelayMessage error messageMap = {}", e, messageMap);
|
|
|
+ return videoUrl;
|
|
|
}
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- return videoUrl;
|
|
|
}
|
|
|
}
|
|
|
}
|