Failed to play a youtube video in iPad
I 开发者_Go百科am currently trying to play a youtube video in iPad but device only display blank screen.
- (void)viewDidLoad {
[super viewDidLoad];
NSURL* videoURL = [NSURL URLWithString:@"http://www.youtube.com/......."];
MPMoviePlayerController * moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayer prepareToPlay];
[moviePlayer play];
[moviePlayer.view setFrame:CGRectMake(50, 200, (self.view.frame.size.width)-100 , 400)];
moviePlayer.view.backgroundColor = [UIColor grayColor];
[self.view addSubview:moviePlayer.view];
}
This will just display a blank gray screen,But if i try to play any locally stored video file then i can able to play by MPMoviePlayerController.So what is the best way to play a youtube video in iPad.
精彩评论