我想選擇一個位於我的iphone上的視頻文件,並將其上傳到服務器。如何選擇一個視頻文件並在iphone上以編程方式上傳到服務器
由於UIImagePicker用於選擇我們的照片庫或其他模式中可用的圖片,是否有任何選擇以編程方式選擇位於我們的iphone中的文件?
在此先感謝。
我想選擇一個位於我的iphone上的視頻文件,並將其上傳到服務器。如何選擇一個視頻文件並在iphone上以編程方式上傳到服務器
由於UIImagePicker用於選擇我們的照片庫或其他模式中可用的圖片,是否有任何選擇以編程方式選擇位於我們的iphone中的文件?
在此先感謝。
首先添加MediaPlayer
框架...
然後下載型MP4的視頻從mobile9.com
然後使用代碼如下
NSString *url=[[NSBundle mainBundle] pathForResource: @"video" ofType:@"mp4"];
MPMoviePlayerController *play1= [[MPMoviePlayerController alloc] initWithContentURL:[NSURL
fileURLwithPath:url];
[play1 setOrientation:UIDeviceOrientationPortrait animated:YES];
[paly1 play];
試試這個代碼.....它的工作..
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];
您好,感謝的答覆,是資產產生庫是唯一的選擇? – SriPriya 2011-01-20 10:22:09