我想选择位于iPhone中的视频文件,并将其上传到服务器。
由于UIImagePicker用于选择照片库或其他模式中可用的照片,是否可以选择以编程方式选择位于我们iPhone中的文件?
答案 0 :(得分:1)
答案 1 :(得分:0)
首先添加MediaPlayer
框架...
然后从mobile9.com下载mp4类型的视频
然后使用以下代码
NSString *url=[[NSBundle mainBundle] pathForResource: @"video" ofType:@"mp4"];
MPMoviePlayerController *play1= [[MPMoviePlayerController alloc] initWithContentURL:[NSURL
fileURLwithPath:url];
[play1 setOrientation:UIDeviceOrientationPortrait animated:YES];
[paly1 play];
尝试此代码......它正在运行..
答案 2 :(得分:0)
to select video from photo library use following code:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
[self presentViewController:imagePicker animated:YES completion:NULL];