iPhone 如何阻止 MPMoviePlayerController 最后关闭?
在我的 iPhone 应用程序中,我使用 MPMoviePlayerController 来播放电影。我隐藏了电影播放器上默认可见的所有控件。但我在播放器控件上放置了一个“重播”按钮。
电影结束时,玩家被移除。但我想停在最后一帧,这样当我单击“重播”按钮时,它将从头开始。我编写了重放功能并且运行良好。当电影正在播放并单击“重播”时,它会从头开始重新启动视频。
我面临的问题是,在电影结束时,它变成白屏,按“重播”按钮不会重新启动电影。遇到这种情况该如何处理呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不需要创建新实例。我找到了解决办法。不要只是释放玩家的实例。单击重播按钮时(无论是在视频中间还是在完成后),只需暂停它,将位置移动到开头并播放即可。就是这样......没有保留,没有释放任何东西......这取决于程序员/开发人员何时释放播放器并将其从视图中删除。
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.
我从未使用过 MPMoviePlayerController 但也许它的实例在电影结束时被释放。在这种情况下,增加保留计数器并手动释放它可以解决问题。
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.