0
我在这里是新的,并且仍然开始,所以在这一点上我忍受。从NSBundle硬编码视频迁移,以允许图像选择器文件
我有上传一个嵌入在项目中的“videoTest.MOV”文件的代码。我想更改该代码以上传我从下面的视频操作中包含的图像选择器代码中选择的视频。
感谢您的帮助,我完全沉迷于此。
// Upload static file to Youtube
-(void)uploadVideoOnYouTube
{
_uploadVideo = [[YouTubeUploadVideo alloc] init];
_uploadVideo.delegate = self;
NSURL *VideoUrl = [[NSBundle mainBundle] URLForResource:@"videoTest" withExtension:@"MOV"];
NSData *fileData = [NSData dataWithContentsOfURL:VideoUrl];
NSString *title;
NSString *description;
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"'Test Video Uploaded ('EEEE MMMM d, YYYY h:mm a, zzz')"];
title = [dateFormat stringFromDate:[NSDate date]];
description = @"This is test";
[self.uploadVideo uploadYouTubeVideoWithService:self.youtubeService
fileData:fileData
title:title
description:description];
}
// Image Picker that only shows movies, no images.
- (IBAction)video:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentModalViewController:imagePicker animated:YES];
}