Bladeren bron

修改视频创建逻辑、新增图片检查接口、新增百度API接口、修改上传阿里云检查、新增回调接口

private_deployment
lrh 1 jaar geleden
bovenliggende
commit
3ce8598a53
1 gewijzigde bestanden met toevoegingen van 22 en 18 verwijderingen
  1. +22
    -18
      suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java

+ 22
- 18
suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java Bestand weergeven

@@ -255,34 +255,38 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService {
PhotoSpeakVideo videoUpd = new PhotoSpeakVideo();
videoUpd.setId(mouldVideo.getId());
videoUpd.setVideoId(result.getVideoId());
videoUpd.setVideoPlayUrl(url);
videoUpd.setCoverImg(result.getCoverURL());
videoUpd.setVideoPlayUrl(result.getVideoUrl());
videoUpd.setVideoTime(result.getDuration());
videoUpd.setVideoSize(result.getSize());
videoUpd.setVideoStatus(EnumVideoStatus.upload_ing.getCode());
this.saveOrUpdate(videoUpd);

AtomicInteger integer = new AtomicInteger(30);
while (true){
String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId());
try {
String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId());
Thread.sleep(1000);
if (progress.equals("complete")) {
VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(result.getVideoId());
if (videoDetail.isSuccess()
&& StringUtils.isNotBlank(videoDetail.getDuration())
&& !"0.0".equals(videoDetail.getDuration())) {
mouldVideo.setCoverImg(videoDetail.getCoverURL());
mouldVideo.setVideoPlayUrl(videoDetail.getVideoUrl());
mouldVideo.setVideoTime(videoDetail.getDuration());
mouldVideo.setVideoSize(videoDetail.getSize());
mouldVideo.setVideoStatus(EnumVideoStatus.upload_success.getCode());
this.updateById(mouldVideo);
break;
}
}

if (integer.getAndDecrement() <= 0){
mouldVideo.setVideoStatus(EnumVideoStatus.fail.getCode());
mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试");
this.updateById(mouldVideo);
break;
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}

if (progress.equals("complete")) {
mouldVideo.setVideoStatus(EnumVideoStatus.upload_success.getCode());
this.updateById(mouldVideo);
break;
}
if (integer.getAndDecrement() <= 0){
mouldVideo.setVideoStatus(EnumVideoStatus.fail.getCode());
mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试");
this.updateById(mouldVideo);
break;
}
}
}
}


Laden…
Annuleren
Opslaan