初始化视频首次加载的时间

This commit is contained in:
wangjinlei
2024-04-24 19:12:30 +08:00
parent 872b9939f9
commit 0764d8dce4
6 changed files with 92 additions and 14 deletions

View File

@@ -6,9 +6,11 @@ import com.aliyun.vod20170321.Client;
import com.aliyun.vod20170321.models.GetVideoPlayAuthRequest;
import com.aliyun.vod20170321.models.GetVideoPlayAuthResponse;
import java.util.HashMap;
public class SpdbUtil {
public static String getPlayAuth(String vid) throws Exception {
public static GetVideoPlayAuthResponse getPlayAuth(String vid) throws Exception {
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
.setAccessKeyId("LTAI5tMKmWhPfnPsz2J3bfxL")
@@ -22,14 +24,15 @@ public class SpdbUtil {
try {
// 复制代码运行请自行打印 API 的返回值
GetVideoPlayAuthResponse videoPlayAuthWithOptions = client.getVideoPlayAuthWithOptions(getVideoPlayAuthRequest, runtimeOptions);
return videoPlayAuthWithOptions.getBody().getPlayAuth();
return videoPlayAuthWithOptions;
// return videoPlayAuthWithOptions.getBody().getPlayAuth();
} catch (TeaException error) {
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
// 错误 message
System.out.println(error.getMessage());
// 诊断地址
System.out.println(error.getData().get("Recommend"));
return "error";
return null;
} catch (Exception _error) {
TeaException error = new TeaException(_error.getMessage(), _error);
@@ -38,7 +41,7 @@ public class SpdbUtil {
System.out.println(error.getMessage());
// 诊断地址
System.out.println(error.getData().get("Recommend"));
return "error";
return null;
}
}