开发者

iPhone how to stop MPMoviePlayerController is closing at the end?

开发者 https://www.devze.com 2023-01-30 20:37 出处:网络
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 con

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 start开发者_JAVA技巧ing.

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号