내 iPhone보기 SDK에서 비디오 갤러리에 액세스 할 수있는 방법. 이 작업에 사용해야하는 개체는 무엇입니까?iPhone/iPod 비디오 갤러리 액세스
내 앱에 모든 동영상 (iPhone/iPod)을 표시하고 웹 서버에 선택한 동영상을 업로드하고 싶습니다.
감사합니다.
내 iPhone보기 SDK에서 비디오 갤러리에 액세스 할 수있는 방법. 이 작업에 사용해야하는 개체는 무엇입니까?iPhone/iPod 비디오 갤러리 액세스
내 앱에 모든 동영상 (iPhone/iPod)을 표시하고 웹 서버에 선택한 동영상을 업로드하고 싶습니다.
감사합니다.
먼저 클래스에서 [UIImagePickerController
을 작성, 당신은 선택 도구에 delegate
속성에 UIImagePickerControllerDelegate 프로토콜 및 와이어 그것을 구현해야합니다. 사용자가 무언가를 선택하면 didFinishPickingMediaWithInfo
에서 선택한 미디어의 위치를 가져올 수 있습니다. 당신이 UIImagePickerController
를 사용하는 경우
// untested
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// this is the file system url of the media
NSURL* videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
// TODO: read in data at videoUrl and write upload it to your server
}
동영상을 선택하려면 시작 지점이 UIImagePickerController
이고 재생을 위해서는 MPMoviePlayerController
및 MPMoviePlayerViewController
입니다.
, 라이브 카메라 대신 라이브러리에 액세스 할 수 sourceType
속성 놀러해야합니다. 자세한 내용은 UIImagePickerControllerSourceType
을 참조하십시오.
enum {
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
};
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
NSArray *mediaTypesAllowed = [NSArray arrayWithObjects:@"public.image", @"public.movie", nil];
[imagePickerController setMediaTypes:mediaTypesAllowed];
[self presentModalViewController:imagePickerController animated:YES];
:
이
은 옵션입니다