开发者学堂课程【微服务+全栈在线教育实战项目演练(SpringCloud Alibaba+SpringBoot):技术点-阿里云视频点播 SDK(获取视频凭证)】学习笔记,与课程紧密连接,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/667/detail/11402
技术点-阿里云视频点播 SDK(获取视频凭证)
获取视频凭证代码与运行结果
public static void main (String[] args) throws Exception {
//根据视频 id 获取视频播放凭证
//创建初始化对象DefaultAcsClientclient=InitObject. initVodClient(accessKeyld:"LTAI4FvvVEWiTJ3GNJJqJnk7", accessKeySecret:"9st82dv7EvFk9mTjY01XXbM632fRbG”);
//创建获取视频凭证 request 和 responseGetVideoPlayAuthRequest request=newGetVideoPlayAuthRequest(: GetVideoPlayAuthResponseresponse newGetVideoPlayAuthResponse():
//向 request 设置视频 id
request.setVideoId("474be24d43ad4f76af344b9f4daaabd1")
//调用初始化对象的方法得到凭证
response=clientgetAcsResponse(request);
System.out. println("playauth:"+response.getPlayAuth())
运行结果:
"D:Program FilesJavaljdk1.8.0_181binjava.exe"...
playauth:eyJIZWN1cml0eVRva2VuIjoiQ0FJUzN3SjFxNkZ0NUIyeWZTaklyNWFBR3VQYnFxbEM1YXVKYTJERGxsRm1YTVJVdWJQeHFEejJJSGxQZTNGaEFPb2V2L2svbVc5VTdmb
Process finished with exit code ()