谷粒学院95——获取视频凭证
获取视频凭证
对于加密视频,地址无法直接播放视频。我们需要得到视频的凭证。
private static void getVideoAuth() throws ClientException {
// 1.创建客户端
DefaultAcsClient client = InitObject.initVodClient("LTAI5tFgGXoyhNYWPMHf3gNz", "C8acTTWjFrySJIarGvSfJVTQNce1vt");
// 2.创建request、response
GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();
GetVideoPlayAuthResponse response = new GetVideoPlayAuthResponse();
// 3.设置视频Id值
request.setVideoId("77b9dd1391c54adf88d7b30efb5486f6");
// 4.获取response
response = client.getAcsResponse(request);
//Base信息
System.out.print("Video Auth = " + response.getPlayAuth() + "\n");//VideoBase.Title = 6 - What If I Want to Move Faster.mp4
}
java全栈日日学 文章被收录于专栏
java全栈每日必学,不要高估自己一年能做的事,不要低估自己十年能做的事