| @@ -73,6 +73,9 @@ public class AliyunVedioServer { | |||||
| return client.getAcsResponse(request); | return client.getAcsResponse(request); | ||||
| } | } | ||||
| private static String toLanEndpoint(String bucket) { | |||||
| return bucket.replace(".aliyuncs.com", "-internal.aliyuncs.com"); | |||||
| } | |||||
| private static OssUploadClient initOssClient(CreateUploadVideoResponse response) throws UnsupportedEncodingException { | private static OssUploadClient initOssClient(CreateUploadVideoResponse response) throws UnsupportedEncodingException { | ||||
| final Base64.Decoder decoder = Base64.getDecoder(); | final Base64.Decoder decoder = Base64.getDecoder(); | ||||
| String uploadAddressStr = new String(decoder.decode(response.getUploadAddress().getBytes("UTF-8"))); | String uploadAddressStr = new String(decoder.decode(response.getUploadAddress().getBytes("UTF-8"))); | ||||
| @@ -85,8 +88,8 @@ public class AliyunVedioServer { | |||||
| String accessKeyId = uploadAuth.getString("AccessKeyId"); | String accessKeyId = uploadAuth.getString("AccessKeyId"); | ||||
| String accessKeySecret = uploadAuth.getString("AccessKeySecret"); | String accessKeySecret = uploadAuth.getString("AccessKeySecret"); | ||||
| String securityToken = uploadAuth.getString("SecurityToken"); | String securityToken = uploadAuth.getString("SecurityToken"); | ||||
| OSS client = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret,securityToken); | |||||
| return new OssUploadClient(bucket, endpoint, fileName, client); | |||||
| OSS client = new OSSClientBuilder().build(toLanEndpoint(endpoint), accessKeyId, accessKeySecret,securityToken); | |||||
| return new OssUploadClient(bucket, toLanEndpoint(endpoint), fileName, client); | |||||
| } | } | ||||
| private static OssUploadClient initOssClient(RefreshUploadVideoResponse response) throws UnsupportedEncodingException { | private static OssUploadClient initOssClient(RefreshUploadVideoResponse response) throws UnsupportedEncodingException { | ||||
| @@ -101,8 +104,8 @@ public class AliyunVedioServer { | |||||
| String accessKeyId = uploadAuth.getString("AccessKeyId"); | String accessKeyId = uploadAuth.getString("AccessKeyId"); | ||||
| String accessKeySecret = uploadAuth.getString("AccessKeySecret"); | String accessKeySecret = uploadAuth.getString("AccessKeySecret"); | ||||
| String securityToken = uploadAuth.getString("SecurityToken"); | String securityToken = uploadAuth.getString("SecurityToken"); | ||||
| OSS client = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret,securityToken); | |||||
| return new OssUploadClient(bucket, endpoint, fileName, client); | |||||
| OSS client = new OSSClientBuilder().build(toLanEndpoint(endpoint), accessKeyId, accessKeySecret,securityToken); | |||||
| return new OssUploadClient(bucket, toLanEndpoint(endpoint), fileName, client); | |||||
| } | } | ||||
| public static void uploadVideo(AliyunVideoConfig config,CreateUploadVideoResponse response,String localFile,RedisTemplate<String, Object> redisTemplate) throws UnsupportedEncodingException { | public static void uploadVideo(AliyunVideoConfig config,CreateUploadVideoResponse response,String localFile,RedisTemplate<String, Object> redisTemplate) throws UnsupportedEncodingException { | ||||