Commit a49b6bedbc61f688fa5a650224c836bbb3d45bbc

Authored by 张旭
1 parent 970b21a9

bucketName验证

CNLiveUploadYunSDKDemo/CNLiveUploadYunSDKDemo/CNLiveUploadController.m
@@ -135,6 +135,14 @@ @@ -135,6 +135,14 @@
135 */ 135 */
136 - (void)beginMultipartUpload 136 - (void)beginMultipartUpload
137 { 137 {
  138 + if(_bucketName == nil){
  139 + _bucketName = [CNLiveUpload getSPBucketName];
  140 + if (!_bucketName) {
  141 + NSLog(@"获取BucketName失败,请检查视讯云上传模块权限是否配置!");
  142 + return;
  143 + }
  144 + }
  145 +
138 NSString *strKey = _bucketKey; 146 NSString *strKey = _bucketKey;
139 _partSize = 5; // 文件大于5M为最小5M一块 147 _partSize = 5; // 文件大于5M为最小5M一块
140 148
@@ -313,6 +321,13 @@ @@ -313,6 +321,13 @@
313 //最小支持但块上传小于5M,最大支持单块上传为5G 321 //最小支持但块上传小于5M,最大支持单块上传为5G
314 - (void)beginSingleUpload:(NSInteger) row 322 - (void)beginSingleUpload:(NSInteger) row
315 { 323 {
  324 + if(_bucketName == nil){
  325 + _bucketName = [CNLiveUpload getSPBucketName];
  326 + if (!_bucketName) {
  327 + NSLog(@"获取BucketName失败,请检查视讯云上传模块权限是否配置!");
  328 + return;
  329 + }
  330 + }
316 CNLiveAccessControlList *ControlList = [[CNLiveAccessControlList alloc] init]; 331 CNLiveAccessControlList *ControlList = [[CNLiveAccessControlList alloc] init];
317 [ControlList setContronAccess:CNLiveYun_Permission_Public_Read_Write]; 332 [ControlList setContronAccess:CNLiveYun_Permission_Public_Read_Write];
318 CNLivePutObjectRequest *putObjRequest = [[CNLivePutObjectRequest alloc] initWithName:_bucketName withAcl:ControlList grantAcl:nil]; 333 CNLivePutObjectRequest *putObjRequest = [[CNLivePutObjectRequest alloc] initWithName:_bucketName withAcl:ControlList grantAcl:nil];