MPMoviePlayerViewController 通知

发布于 2024-12-04 08:59:41 字数 90 浏览 5 评论 0原文

如何设置 MPMoviePlayerViewController 的通知?和 MPMoviePlayerController 中的一样吗?

请显示示例

How to set notifications to MPMoviePlayerViewController? Is it the same as in MPMoviePlayerController?

Show example please

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷清清 2024-12-11 08:59:43

MPMoviePlayerViewController 只是一个包装器,为您提供对 MPMoviePlayerController 的控制。

MPMoviePlayerViewController 有自己的 MPMoviePlayerController,它会发送您使用它所需的所有通知。

收听通知的方式如下:

// Register for the playback finished notification
[[NSNotificationCenter defaultCenter] addObserver:self // the object listening / "observing" to the notification
    selector:@selector(myMovieFinishedCallback:) // method to call when the notification was pushed
    name:MPMoviePlayerPlaybackDidFinishNotification // notification the observer should listen to
    object:self.moviePlayerViewController.moviePlayer]; // the object that is passed to the method

MPMoviePlayerController 类参考

所以基本上,是的 - 您可以使用与中相同的通知MPMoviePlayerController

The MPMoviePlayerViewController is just a wrapper giving you controls to a MPMoviePlayerController.

MPMoviePlayerViewController has its own MPMoviePlayerController that sends all the notifications you need to work with it.

Listening to notifications is done as follows:

// Register for the playback finished notification
[[NSNotificationCenter defaultCenter] addObserver:self // the object listening / "observing" to the notification
    selector:@selector(myMovieFinishedCallback:) // method to call when the notification was pushed
    name:MPMoviePlayerPlaybackDidFinishNotification // notification the observer should listen to
    object:self.moviePlayerViewController.moviePlayer]; // the object that is passed to the method

There are a lot more notifications you can and should work with that are listed in the MPMoviePlayerController Class Reference

So basically, yes - You can use the same notifications as in MPMoviePlayerController

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文