视频播放问题

This commit is contained in:
xiezhijun
2021-07-08 18:29:37 +08:00
parent fb8a266b94
commit 9b86f2e557
13 changed files with 318 additions and 5 deletions

View File

@ -137,6 +137,29 @@ public class AliyunVideoUtils {
return client.createUploadVideo(createUploadVideoRequest);
}
/**
* 根据视频ID获取对应播放凭证
* @param videoId
* @return
* @throws Exception
*/
public static String getVideoPlayAuth(String videoId) throws Exception{
com.aliyun.vod20170321.Client client = AliyunVideoUtils.createClient();
GetVideoPlayAuthRequest getVideoPlayAuthRequest = new GetVideoPlayAuthRequest()
.setVideoId(videoId);
GetVideoPlayAuthResponse response = client.getVideoPlayAuth(getVideoPlayAuthRequest);
if(response != null){
GetVideoPlayAuthResponseBody body = response.body;
if(body != null && StringUtils.isNotEmpty(body.playAuth)){
return body.playAuth;
}
}
return null;
}
/**
*
* @param key