We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String endpoint = "http://oss-us-east-1.aliyuncs.com"; //自己查oss所在的endpoint 文档地址 https://help.aliyun.com/document_detail/31837.htm?spm=a2c4g.11186623.0.0.256146977ntkdT#concept-zt4-cvy-5db String bucket = " oos的名称 "; String stsServer = "自己搭建的sts服务器地址,需要修改参数"; //我用PHP搭建的,修改的地方有 config.json里面的 AccessKeyID 、AccessKeySecret、RoleArn 三个全改 policy文件里面,设置读写权限文件的 Resource 需要改 "Resource": ["acs:oss:*:*:你自己的oss的名称/*"] //使用自己的获取STSToken的类 OSSCredentialProvider credentialProvider; credentialProvider = new OSSAuthCredentialsProvider(stsServer); ClientConfiguration conf = new ClientConfiguration(); conf.setConnectionTimeout(15 * 1000); // 连接超时,默认15秒 conf.setSocketTimeout(15 * 1000); // socket超时,默认15秒 conf.setMaxConcurrentRequest(5); // 最大并发请求书,默认5个 conf.setMaxErrorRetry(2); // 失败后最大重试次数,默认2次 OSS oss = new OSSClient(getApplicationContext(), endpoint, credentialProvider, conf); mService = new OssServiceWithCallBack(oss, bucket); //OssServiceWithCallBack这个我自己用官方的 OssService修改的,自己加了回调 mService.initOss(oss);
上面是初始化,使用的时候 mService.asyncPutImage 我不明白,为什么请求进行中和请求成功和失败不放到一起,反而分了两个接口,我也懒的改凑合用吧
mService.asyncPutImage("1.mp4", locationpath, new OSSProgressCallback<PutObjectRequest>() { @Override public void onProgress(PutObjectRequest request, long currentSize, long totalSize) { } }, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() { @Override public void onSuccess(PutObjectRequest request, PutObjectResult result) { } @Override public void onFailure(PutObjectRequest request, ClientException clientException, ServiceException serviceException) { } });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
上面是初始化,使用的时候 mService.asyncPutImage 我不明白,为什么请求进行中和请求成功和失败不放到一起,反而分了两个接口,我也懒的改凑合用吧
The text was updated successfully, but these errors were encountered: