gpt4 book ai didi

iphone - ipad 中的 itunes 库工具

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:46:32 25 4
gpt4 key购买 nike

我正在开发一个无法在我的应用程序中访问 iPod 视频的应用程序。所以我正在考虑集成 iTunes。这样我就可以从 iTunes 商店和商店下载视频它到本地目录,从那个目录我可以播放视频。

我可以在 popOverController 中播放照片库中的视频,但无法在

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

//////////////////////////////////////函数确实选择了视频//////////////////

- (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 播放。因此,如果有人完成了 Itunes Store 集成,请指出正确的方向。谢谢

最佳答案

您实际上需要将 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

关于iphone - ipad 中的 itunes 库工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7685409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com