... | @@ -277,17 +277,26 @@ include|SDK开放的头文件及静态库,同demo中的SDK文件夹 |
... | @@ -277,17 +277,26 @@ include|SDK开放的头文件及静态库,同demo中的SDK文件夹 |
|
|
|
|
|
### 3.3 上传功能
|
|
### 3.3 上传功能
|
|
|
|
|
|
#### 3.3.1 初始化DWUploader对象,调用start方法,即可上传视频
|
|
#### 3.3.1 通过DWVideoCompressController,选择要上传的视频
|
|
|
|
|
|
```
|
|
```
|
|
//videoTitle不得为空 videoPath音视频文件路径
|
|
DWVideoCompressController *imagePicker = [[DWVideoCompressController alloc] initWithQuality: DWUIImagePickerControllerQualityTypeMedium andSourceType:DWUIImagePickerControllerSourceTypePhotoLibrary andMediaType:DWUIImagePickerControllerMediaTypeMovie];
|
|
DWUploader *uploader = [[DWUploader alloc] initWithuserId:@"账号ID"
|
|
imagePicker.delegate = self;
|
|
andKey:@"APIKey"
|
|
[self presentViewController:imagePicker animated:NO completion:nil];
|
|
uploadVideoTitle:@"视频标题"
|
|
```
|
|
videoDescription:@"视频描述"
|
|
|
|
videoTag:@"视频tag"
|
|
#### 3.3.2 获取到本地视频路径,通过DWUploadSessionManager创建DWUploadModel,开始上传
|
|
videoPath:@"视频本地路径"
|
|
|
|
notifyURL:@"回调地址"];
|
|
```
|
|
//开始上传
|
|
//注意!获取到上传路径之后,请务必调用moveToLocalWithVideoPath:方法获取SDK所需的视频url,否则可能会出现上传失败,找不到视频文件等情况。
|
|
[uploader start];
|
|
NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
|
|
|
|
//选中视频以后,请务必调用此方法,否则可能会出现上传失败,找不到视频文件等情况。
|
|
|
|
self.videoPath = [self.manager moveToLocalWithVideoPath:[videoURL path]];
|
|
|
|
|
|
|
|
//填写完视频信息以后,通过DWUploadSessionManager创建DWUploadModel。
|
|
|
|
DWUploadModel * uploadModel = [DWUploadSessionManager createUploadModelWithUserId:userId Apikey:apiKey VideoTitle:videoTitle VideoDescription:videoDescription VideoTag:videoTag VideoPath:self.videoPath CategoryId:nil NotifyURL:nil];
|
|
|
|
|
|
|
|
//DWUploadModel创建成功以后,调用startWithUploadModel:方法,即可开始上传视频
|
|
|
|
[self.manager startWithUploadModel:uploadModel];
|
|
|
|
|
|
``` |
|
``` |