mpmovieplayercontroller 停止功能,然后以当前时间播放(iPhone)
我有这样的情况: 播放(流式传输)视频,通过编码停止视频,然后再次播放。 问题是视频是从头开始的,而不是我停止时开始的。
您现在采取什么解决方案?
I have this situation:
Play (streamed) video, stop by code the video, and then play again.
The problem is that the video is begin from the start and not when i stopped it.
What solution do you now of?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:正如@willcodejavaforfood所指出的, stop 仅暂停电影 - 调用 play 应该从您停止的地方重新开始,因此您不需要我的答案!您可以发布您正在使用的代码,以便我们看看发生了什么吗?谢谢。
如果您希望它从上次中断的地方重新开始,您需要记住您看完电影的进度并设置 initialPlaybackTime 属性,然后再次调用播放。
ie 存储开始电影的时间
存储停止电影的时间 当你
再次开始播放时,使用这些时间之间的差值
Sam
PS 要强制它从头开始,只需将初始播放时间设置为 0.0
PPS I不知道 NSDate 以毫秒为单位有多准确,因此您可能必须使用更好的方法来计算电影中的当前位置:)
EDIT: As @willcodejavaforfood has pointed out, stop only pauses the movie - calling play should restart where you left off so you shouldn't ever need my answer! Can you post the code you are using so we can see what's going on? Thanks.
If you want it to restart where you left off, you will need to remember how far through the movie you were and set the initialPlaybackTime property before you call play again.
i.e. Store the time when you start the movie
Store the time you stop the movie
And when you start playback again, use the difference between these times
Sam
PS To force it to start at the start, just set the initial playback time to 0.0
PPS I don't know how accurate NSDate is in milliseconds so you might have to use a better way of working out the current position in the movie :)