MPMoviePlayercontroller 是否可以有自己的洗涤器
我想播放视频。我正在使用 MPMoviePlayer,但我不想使用 MPMoviePlayer 提供的控件。所以我正在尝试创建自己的自定义控件。播放、暂停、全屏、前进、后退等所有功能均已完成。唯一的问题是洗涤器。我有一个 UISlider,但我不知道它到底如何工作。如何追踪当前播放视频的时间?如何从滑动滑块的位置播放视频? 如果有人知道这一点,请帮助我。
提前致谢。
I want to play videos. I am using MPMoviePlayer, but I don't want to use the controls provided by MPMoviePlayer. So I am trying to create my own custom controls. All the functionality like play, pause, fullscreen, forward, backward are done. The only problem is with the scrubber. I am having one UISlider but I don't know how exactly work with this. How to track the currently playing video time? How to play video from where I will slide the thumb of slider?
If anyone knows this kindly help me in this.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有类似的问题。我弄清楚了如何创建自定义电影控件并将其放在 github 上。让我知道这是否有帮助。如果您想了解详细信息,请随时问我任何问题。
I was having a similar problem. I figured out how to create custom movie controls and put it up on github. Let me know if that helps. Feel free to ask me any questions if you want details.
首先,我们应该注意到,如果您可以不支持 iOS 3.1.x,那么所有这些都可以在 iOS 3.2+ 中实现。
在 iOS 3.2+ 中,MPMoviePlayerController 实现了 MPMediaPlayback 协议,这意味着它可以响应播放、停止等,以及您期望的所有控件 - 听起来您已经有了其中的一些功能。请参阅 MPMediaPlayback 协议参考。
要让 MPMoviePlayerController 停止显示自己的控件,请在初始化时执行以下操作:
最后,要使洗涤器正常工作,您需要将 UISlider valueChanged: 回调设置为某项,并更新
currentPlaybackTime
的值财产。如果你想在以下位置寻找 10 秒:First, we should note that all of this is possible in iOS 3.2+, if you are OK not to support iOS 3.1.x.
In iOS 3.2+, MPMoviePlayerController implements the MPMediaPlayback protocol, meaning that it responds to play, stop, etc., all the controls you would expect -- sounds like you already have some of this working. Please see the reference for the MPMediaPlayback protocol.
To get the MPMoviePlayerController to stop showing its own controls, do this on initialization:
Finally, to get the scrubber to work, you need to set the UISlider valueChanged: callback to something, and update the value of
currentPlaybackTime
property. If you want to seek 10 seconds in: