Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sanjeev

macrumors newbie
Original poster
Dec 18, 2009
11
0
Hi All,

I am working on creating my current app which I developed for iPhone to work as Universal App.

For playing the videos, as per the instructions given in iPhone SDK 3.2, I am first creating the MPMoviePlayerViewController's object and then passing the URL of the video file to that object. In same method, I am writing the notification "MPMoviePlayerPlaybackDidFinishNotification".

Now when I first play the video, the video is visible, when I click on Done button or when the video finishes automatically, the video controller view disappears (this is what I require). But when I again open the video, only audio is coming, but its not showing any video.

Here is the code which I am writing for playing the video:


MPMoviePlayerViewController *playerViewController_iPad = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated: playerViewController_iPad];
[playerViewController_iPad release];
playerViewController_iPad.moviePlayer.initialPlaybackTime = 0;


[[NSNotificationCenter defaultCenter] addObserver:self selector:mad:selector(moviePlayBackDidFinished:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:playerViewController_iPad.moviePlayer];


And in notification method:

MPMoviePlayerController *player1 = [_notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player1];
[player1 stop];
player1.initialPlaybackTime = -1;
[self dismissMoviePlayerViewControllerAnimated];


Please review this code and if anybody has any clue on it, please post it. I need it very urgently.

Thanks in Advance..
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.