2011-10-07 7 views
3

내 app.so에서 iPod 비디오에 액세스 할 수없는 응용 프로그램에서 작업 중입니다. iTunes.so를 통합하여 비디오를 다운로드 할 수 있다고 생각합니다. iTunes Store에서 가져 와서 로컬 디렉토리에 저장하면 해당 디렉토리에서 비디오를 재생할 수 있습니다.ipunes에서 iTunes 라이브러리 구현

나는 /////////////////////

-(IBAction)SelectVideo:(id)sender 
    { 

     UIImagePickerController *ImageVideoPicker = [[UIImagePickerController alloc] init]; 
     ImageVideoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
     ImageVideoPicker.delegate = self; 
      [ImageVideoPicker setMediaTypes:[NSArray arrayWithObjects:(NSString *)kUTTypeMovie, nil]]; 

    /////////videoLibrary is PopOver to show Videos Of photo gallery//////// 
      VideoLibrary= [[UIPopoverController alloc] 
       initWithContentViewController:ImageVideoPicker]; 
      [VideoLibrary presentPopoverFromRect:addVideo.frame inView:self.videoView permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 
} 

에서 재생할 수 popOverController에 사진 갤러리에서 동영상을 재생할 수는 없지만 ///////////////////// function이 비디오를 선택했습니다 ///////////////////

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 

     NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType]; 
     if ([mediaType isEqualToString:@"public.movie"]){ 

    NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL]; 
    UIAlertView *alurl=[[UIAlertView alloc]initWithTitle:@"message" message:videoURL delegate:self cancelButtonTitle:@"ok" otherButtonTitles:@"cancel", nil]; 
      [alurl show]; 
      [alurl release]; 
    //////////////this url is used to play video in 
app.VideoUrl=videoURL;   
    NSLog(@"%@",app.VideoUrl); 

} 
[picker dismissModalViewControllerAnimated:YES]; 
} 

나는이 app.videoUrl.So에서 놀 수 없다. 누군가가 iTunes Store 통합을 완료했다면 올바른 방향으로 나를 가리 키도록한다. 감사

답변

0

당신은 적절한 비트 마스크로 설정 mediaTypes 속성으로있는 MPMediaPickerController을 원하는 실제로 것 :

// video media types 
MPMediaTypeMovie  = 1 << 8, 
MPMediaTypeTVShow  = 1 << 9, 
MPMediaTypeVideoPodcast = 1 << 10, 
MPMediaTypeMusicVideo = 1 << 11, 
MPMediaTypeVideoITunesU = 1 << 12, 
MPMediaTypeAnyVideo  = 0xff00, 

// generic media type 
MPMediaTypeAny   = ~0 
+0

가 음악을 다루는 유사한 SO 질문은, 그러나있는 MPMediaPickerController를 사용의 좋은 예를 보여줍니다 http://stackoverflow.com/questions/1665119/how-to-play-a-song-from-the-itunes-library-in-iphone –