How to see a video from YouTube on Iphone
How to see a video from YouTube on Iphone
- Subject: How to see a video from YouTube on Iphone
- From: Guillermo Moral <email@hidden>
- Date: Fri, 27 May 2011 10:58:52 -0300
Which is the best way to show a video from YouTube on iphone like you see
when you implement MoviePlayerCotroller?
Does anyone have an example?
Thanking you in advance
An Example using MoviePlayerController
- (IBAction)playVideo:(id)sender {
[playButton setImage:playButtonImage forState:UIControlStateNormal];
NSString *filepath = [[NSBundle mainBundle]
pathForResource:@"myVideo" ofType:@"mov"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController =
[[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view setFrame:CGRectMake(31, 130, 477, 360)];
[self.view addSubview:moviePlayerController.view];
[moviePlayerController play];
}
- (void)moviePlaybackComplete:(NSNotification *)notification {
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController stop];
[moviePlayerController.view removeFromSuperview];
[moviePlayerController autorelease];
}
Willy Moral
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden