开发者

itunes library implement in ipad

I'm working on an application in which i am not able to access the iPod videos in my app.so I'm thinking about integrating the iTunes.so that i can be able to download the videos from iTunes store and store it to local directory and from that directory i can be able to play the videos.

I can play the videos from photo gallery in popOverController but not be able to play it in

-(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]
               initWithCo开发者_运维知识库ntentViewController:ImageVideoPicker];
          [VideoLibrary presentPopoverFromRect:addVideo.frame inView:self.videoView   permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}

//////////////////////////////////////////function did select the video//////////////////

- (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];
 }

i am not be able to play from this app.videoUrl.So if anyone had done Itunes Store integration then please point me to the right direction. thanks


You'll actually want the MPMediaPickerController with the mediaTypes property set to the appropriate bitwise mask:

// 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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜