MPMovie播放器如何获取播放时间?

发布于 2024-08-19 05:31:37 字数 98 浏览 7 评论 0原文

我试图浏览 iPhone 媒体播放器的示例代码。

我希望能够捕获媒体播放器播放视频的时间。媒体播放器停止的持续时间。有没有一种方法或属性可以告诉我媒体播放的持续时间?

I was trying to go through the iPhone's sample code for mediaplayer.

I want to be able to capture the amount of time the media player has played the video. The duration at which the media player has stopped. Is there a method or property that will tell me the duration of play of the media??

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

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

发布评论

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

评论(3

全部不再 2024-08-26 05:31:37

不幸的是,当前的 MPMoviePlayerController API 基本上不允许控制。您可以告诉它播放和停止...否则哪里有委托方法,以便您可以在电影播放完毕时收到通知,仅此而已,没有其他控件。 (真是无赖)

然而,虽然我们还不能讨论新的 3.2 SDK,但我会给你一个提示,并告诉你去看看 3.2 中的 MPMoviePlayer 文档,我想你会很高兴的。

http://developer.apple. com/iphone/prerelease/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html

Unfortunately the current API for MPMoviePlayerController allows basically no control. You can tell it to play and stop... otherwise where's a delegate method so you can be notified when the movie finishes playing and that's it, there's no additional controls. (a real bummer)

However, while we cant discuss the new 3.2 SDK yet, I'll give you a tip and say go look at the documentation of MPMoviePlayer in 3.2 and I think you'll be happy.

http://developer.apple.com/iphone/prerelease/library/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html

盛夏已如深秋| 2024-08-26 05:31:37
moviePlayer.currentPlaybackTime

不可能对其进行 KVO,但你可以像我一样创建一个 ScheduledTimer,它每秒更新一次以检查当前播放时间并相应地更新你的图形:)

moviePlayer.currentPlaybackTime

It's not possible to do KVO on it but you could do like me and create an scheduledTimer which updates every second to check what the current playbacktime is and update your graphics accordingly :)

土豪 2024-08-26 05:31:37

是的,您可以使用 MPMediaPlayerController 定义的属性“duration”。请尝试一下并检查输出。您可以参考这里持续时间属性

Yes, You can use the property "duration" defined by MPMediaPlayerController. Plese try it out and check the output. U can refer the here duration property

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