如何以编程方式退出电影播放器?
我有一个带有按钮的简单视图。单击时会弹出电影播放器(使用 MoviePlayer.framework)。我想以编程方式单击“完成”按钮或以某种方式退出电影播放器并返回到上一个视图。
我可以获得电影播放器窗口的句柄,但如何结束它?
I have a simple view with a button. When clicked it pops up movie player (Using the MoviePlayer.framework). I want to programmatically click the Done button or some how exit the movie player and return to previous view.
I can get a handle to movie player's window but how can I end it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,最后,我可以在这里提供帮助:
好的,首先,当您创建播放器时,您可以将自己指定为 MPMoviePlaybackDidFinishNotification 的观察者。这意味着,当“完成”按钮或电影播放完毕时,会调出此通知。
因此,您现在必须指定一个由通知中心调用的方法。
然后您所需要做的就是创建 moviePlayBackDidFinish 方法并从那里关闭播放器。如果您需要更多代码,请告诉我们。
AHH, finally, i can help with something here:
Ok, at first, when you create the player, you can assign yourself as an observer to MPMoviePlaybackDidFinishNotification. That means, when the "done" button or the movie is done playing, this notification is called out.
So you now have to assign a method to be called by the notification center.
Then all you need is to create the moviePlayBackDidFinish method and close the player from there. If you need more code, let us know.