0

In my iPhone app, I'm using MPMoviePlayerController to play a movie. I'm hiding all the controls that are by default visible on the movie player. But I placed a "Replay" button over the player control.

At the end of movie, the player is being removed. But I want to stop at the last frame, so that when I click "Replay" button, it will start from beginning. I wrote the functionality for replay and its working good. When ever the movie is playing and on click of "Replay", its restarting the video from starting.

The problem I'm facing is that, at the end of movie its becoming white screen and pressing "Replay" button is not restarting the movie. How to handle this situation?

Satyam
  • 15,493
  • 31
  • 131
  • 244

2 Answers2

0

Its not necessary to create new instance. I found out the solution. Don't just release the instance of player. When replay button is clicked (either in middle of video or after completion), just pause it, move the location to beginning and play it. That's it.. no retain, no release nothing.... Its upto the programmer/developer when to release the player and remove it from the view.

Satyam
  • 15,493
  • 31
  • 131
  • 244
-1

I never used MPMoviePlayerController but pherhaps it's instance is released when the movie has ended. In this case incrementing the retaincounter and manually releasing it would solve the problem.

Amandir
  • 679
  • 1
  • 7
  • 20
  • It might be a work around and not the exact solution. There must be some perfect solution for this. – Satyam Dec 13 '10 at 13:31
  • Why should that be a work around? incrementing retain counters is a way approved by apple guidelines to maintain instances of objects which you want to use later on. But btw: I just stumbled upon this: http://stackoverflow.com/questions/2870537/how-to-keep-mpmovieplayercontroller-open-after-movie-ended seems like incrementing the retain counter wouldnt help either. Why don't you just create a new instance in you -replay ? – Amandir Dec 13 '10 at 13:53