|
@@ -1,5 +1,6 @@
|
|
package cn.com.ctop.common.module.service.impl;
|
|
package cn.com.ctop.common.module.service.impl;
|
|
|
|
|
|
|
|
+import cn.com.ctop.common.module.constant.CosConstant;
|
|
import cn.com.ctop.common.module.entity.*;
|
|
import cn.com.ctop.common.module.entity.*;
|
|
import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
|
|
@@ -26,6 +27,7 @@ import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
+import java.net.URLDecoder;
|
|
import java.nio.channels.FileChannel;
|
|
import java.nio.channels.FileChannel;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
@@ -90,12 +92,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
if(taskDetailResponse.getStatus().equals("FINISH")){
|
|
if(taskDetailResponse.getStatus().equals("FINISH")){
|
|
String videoUrl=taskDetailResponse.getWorkflowTask().getMediaProcessResultSet()[0].getTranscodeTask().getOutput().getPath();
|
|
String videoUrl=taskDetailResponse.getWorkflowTask().getMediaProcessResultSet()[0].getTranscodeTask().getOutput().getPath();
|
|
VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
|
|
VideoWatermarkTask videoWatermarkTask = new VideoWatermarkTask();
|
|
- videoWatermarkTask.setVideoUrl(videoUrl);
|
|
|
|
|
|
+ videoWatermarkTask.setVideoUrl(CosConstant.COS_MEDIA_URL_PREFIX+videoUrl);
|
|
videoWatermarkTask.setVideoId(materialId);
|
|
videoWatermarkTask.setVideoId(materialId);
|
|
videoWatermarkTask.setJobId(taskId);
|
|
videoWatermarkTask.setJobId(taskId);
|
|
videoWatermarkTask.setUserId(userId);
|
|
videoWatermarkTask.setUserId(userId);
|
|
videoWatermarkTask.setStatus(taskDetailResponse.getStatus());
|
|
videoWatermarkTask.setStatus(taskDetailResponse.getStatus());
|
|
videoWatermarkTaskService.save(videoWatermarkTask);
|
|
videoWatermarkTaskService.save(videoWatermarkTask);
|
|
|
|
+ materialInfo.setWatermarkUrl(CosConstant.COS_MEDIA_URL_PREFIX+videoUrl);
|
|
materialInfo.setWatermarkCode(taskId);
|
|
materialInfo.setWatermarkCode(taskId);
|
|
this.updateById(materialInfo);
|
|
this.updateById(materialInfo);
|
|
}
|
|
}
|
|
@@ -495,6 +498,29 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
|
|
info.setCreateTime(new Date());
|
|
info.setCreateTime(new Date());
|
|
info.setUpdateTime(new Date());
|
|
info.setUpdateTime(new Date());
|
|
info.setType(type);
|
|
info.setType(type);
|
|
|
|
+
|
|
|
|
+ MaterialCutFrame cutFrame = materialCutFrameService.getCutFrameByCode(code);
|
|
|
|
+ if (Check.isNull(cutFrame)) {
|
|
|
|
+ String videoUrl = URLDecoder.decode(info.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
|
|
|
|
+ String loadImage = "cutFrame/" + code + "/zero.jpg";
|
|
|
|
+ String coverUrl = CloudVideoProcessUtil.videoCutPictureHandle(videoUrl, loadImage);
|
|
|
|
+ info.setCoverUrl(coverUrl);
|
|
|
|
+ Thread thread = new Thread() {
|
|
|
|
+ @Override
|
|
|
|
+ public void run() {
|
|
|
|
+ try {
|
|
|
|
+ log.info("开始抽帧");
|
|
|
|
+ materialCutFrameService.getTencentCutFrame(videoUrl, code, coverUrl);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ thread.start();
|
|
|
|
+ } else {
|
|
|
|
+ info.setCoverUrl(cutFrame.getUrl());
|
|
|
|
+ }
|
|
|
|
+
|
|
this.save(info);
|
|
this.save(info);
|
|
|
|
|
|
JSONArray imageArr = json.getJSONArray("imageArr");
|
|
JSONArray imageArr = json.getJSONArray("imageArr");
|