|
|
@@ -97,8 +97,6 @@ public class AiVideoHelper { |
|
|
|
// return result; |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static AiPhotoSpeakResult createPhotoSpeakVideo(AiPhotoSpeakParam videoParam) { |
|
|
|
log.info("生成视频start request:" + videoParam.neglectImgString()); |
|
|
|
String response = doPost(url, JSONObject.toJSONString(videoParam)); |
|
|
@@ -109,24 +107,26 @@ public class AiVideoHelper { |
|
|
|
result.setMsg("请求生成视频异常,请稍后重试"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(response); |
|
|
|
JSONObject status = jsonObject.getJSONObject("status"); |
|
|
|
Integer code = status.getInteger("code"); |
|
|
|
String msg = status.getString("msg"); |
|
|
|
if (code == null) { |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg("请求生成视频异常,请稍后重试"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
if (code.intValue() == 1000) { |
|
|
|
if (code.intValue() == 4000) { |
|
|
|
JSONObject data = jsonObject.getJSONObject("data"); |
|
|
|
String videoUrl = data.getString("url"); |
|
|
|
result.setSuccess(true); |
|
|
|
result.setMsg("success"); |
|
|
|
result.setMsg(msg); |
|
|
|
result.setUrl(videoUrl); |
|
|
|
} else { |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg(status.getString("msg")); |
|
|
|
result.setMsg(msg); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
@@ -184,12 +184,13 @@ public class AiVideoHelper { |
|
|
|
// |
|
|
|
// AiVideoResult video = AiVideoHelper.createVideo(videoParam); |
|
|
|
|
|
|
|
|
|
|
|
AiPhotoSpeakParam param = new AiPhotoSpeakParam(); |
|
|
|
param.setGen_txt("dasdadklfjskjf"); |
|
|
|
param.setGen_txt("人多泰达股份冲冠怒发代发"); |
|
|
|
param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); |
|
|
|
param.setGender("male"); |
|
|
|
param.setVoice_id("en-US-BrandonNeural"); |
|
|
|
param.setVoice_style("default"); |
|
|
|
param.setVoice_id("zh-CN-YunxiNeural"); |
|
|
|
param.setVoice_style("sad"); |
|
|
|
param.setUrl("None"); |
|
|
|
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); |
|
|
|
|
|
|
|