MPMoviePlayer setCurrentPlaybackTime iOS [英] MPMoviePlayer setCurrentPlaybackTime iOS
问题描述
我使用 MPMoviePlayer 播放视频,我遇到的问题是,当用户按下设备的 home 按钮时,我保存了视频的当前位置,而不是当他再次午餐应用程序时,我希望他从他离开的地方开始,所以我使用 setCurrentPlaybackTime 函数,它在 iOS 5中非常有效 ,但不在视频从头开始的 iOS 5.1 中.
任何人都可以解决此类问题吗?
我的问题已解决,我将解释到目前为止我所做的事情.
当我找不到该行为的解决方案/解释时(我觉得很奇怪),我开始进行大量的日志记录,所以我注意到的是当我记录当前位置时(在iOS 5.1中) )
currentPlaybackTime = nan
但是在iOS 5中,我的正常值为0.00000
因此我设置了一个计时器(重复执行)以每次记录当前时间,因此我注意到它从 nan 更改为 0.00000 一段时间后
我得出的结论是,我需要在设置PlaybackTime之前稍等一会(不明白为什么),所以在等待1 ms (1/1000 s ),并且可以正常工作.
I use MPMoviePlayer to play my video, the problem I have is when the user press the home button of the device, I save the current position of the video, than when he lunch the application again I would like him to start from where he left, so I use setCurrentPlaybackTime function, it works perfectly in iOS 5 but not in iOS 5.1 where the video starts from the beginning.
Does any body have a solution for this kind of problem ?
My problem is solved and I will explain what I've done so far.
When I couldn't find a solution/explanation of that behavior (which I find it strange) I start making lot and lot of logging, so what I noticed is when I log the current position I get always (in iOS 5.1)
currentPlaybackTime = nan
but in iOS 5 I got a normal value as 0.00000
so I made a timer (which repeats itself) to log every time the current time, so I noticed that its changing from nan to 0.00000 after a while
The conclusion I made is that I need to wait a bit (don't understand why) before setting the PlaybackTime, and so it is, after waiting 1 ms (1/1000 s) and it works.
这篇关于MPMoviePlayer setCurrentPlaybackTime iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!