Hello,
I'm trying to stream a .mp4 movie/youtube movie in MPMoviePlayerController. I've found an example from stanford university but the movie does start, I can hear the sound play, but the movie itself isn't visible.
The first test was with an .mp4 movie but actually I want the MoviePlayer to play a youtube movie that I export from my xml feed.
I don't want to open the youtube app so I want to use MoviePlayer for that, does anyone has the solution for this viewing problem or an example for how to play the youtube movie in the app itself?!
Here is the code that play's the movie:
Code:
- (void)playVideoWithURL:(NSURL *)url showControls:(BOOL)showControls {
if (!player) {
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlaying:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
NSLog(@"Play video");
if (!showControls) {
player.scalingMode = MPMovieScalingModeAspectFill;
player.movieControlMode = MPMovieControlModeHidden;
}
[player play];
}
}
- (IBAction)playVideoWithControls {
NSURL *url = [NSURL URLWithString:@"*/yamaha_r6.mp4"];
[self playVideoWithURL:url showControls:YES];
}