视频上传修改优化

This commit is contained in:
xiezhijun
2021-05-10 18:42:13 +08:00
parent 8600f48740
commit 776f8761ad
4 changed files with 38 additions and 4 deletions

View File

@ -238,6 +238,29 @@ public class AliyunVideoUtils {
return result;
}
/**
* 根据VideoId获取封面
* @param videoId
* @return
*/
public static String getVideoCoverUrl(String videoId){
String coverUrl = null;
try{
com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient();
GetVideoInfoRequest getVideoInfoRequest = new GetVideoInfoRequest()
.setVideoId(videoId);
GetVideoInfoResponse response = client.getVideoInfo(getVideoInfoRequest);
if(response != null){
GetVideoInfoResponseBody body = response.body;
GetVideoInfoResponseBody.GetVideoInfoResponseBodyVideo video = body.video;
coverUrl = video.coverURL;
}
}catch (Exception e){
e.printStackTrace();
}
return coverUrl;
}