MPMoviePlayerController:无法停止视频并切换回 iPhone 应用程序
我正在制作一个 iPhone 应用程序,其中需要将视频嵌入到应用程序中。我正在使用 MPMoviePlayerController 类实例在我的 iPhone 应用程序中播放视频。现在如何停止视频并视频结束后返回应用程序?
现在,即使视频结束后,moviePlayer(即 MPMoviePlayerController
的实例)仍保持打开状态。
请帮助和建议。
I am making an iPhone app, where in there is a requirement for embedding video into the app. I am using MPMoviePlayerController
class instance to play the video inside my iPhone app. Now how to stop the video and come back to the application when the video finishes?
Right now even after the video finishes the moviePlayer ( i.e. instance of MPMoviePlayerController
) remains open.
Please Help and Suggest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以注册 MPMoviePlayerController 在完成时发出的 NSNotification。这是一个例子:
一个好的地方是把它放在主 ViewController 类的“viewDidLoad”中。
然后在你的方法“movieFinishedCallback:”(它获取一个作为参数传入的 NSNotification 对象,如果你愿意的话,你可以使用它来查找有关所发生的结束类型的更多详细信息)中,你只需关闭 movieplayercontroller 即可。
You to register for an NSNotification that the MPMoviePlayerController sends out when it finishes. Here is an example:
A good place to put that is inside "viewDidLoad" of your main ViewController class.
Then inside your method "movieFinishedCallback:" (which gets an NSNotification object passed in as an argument, which you can use to find our more detail about the kind of finishing that happened if you like) you simply dismiss the movieplayercontroller.
您需要检查为 MPMoviePlayerController 提供的默认属性和方法。您可以访问链接 http://developer.apple。 com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html。您应该了解 MPMoviePlayer 的方法。有播放、停止等方法。
You need to check the default property and methods provided for MPMoviePlayerController. You can go through the link http://developer.apple.com/library/ios/#samplecode/MoviePlayer_iPhone/Introduction/Intro.html. You should know about the methods of MPMoviePlayer. There is methods like Play,stop and many more.