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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]