To solve this problem, how I realized this unpleasant state coverage in one of my projects. It is unpleasant and fragile, but I worked well enough for me.
I used two flags and two time intervals;
BOOL seekInProgress_;
BOOL seekRecoveryInProgress_;
NSTimeInterval seekingTowards_;
NSTimeInterval seekingRecoverySince_;
All of the above should be the default NOand 0.0.
When starting the search:
if (movieController_.currentPlaybackTime != seekToTime)
{
movieController_.currentPlaybackTime = seekToTime;
seekingTowards_ = seekToTime;
seekInProgress_ = YES;
}
:
if (seekInProgress_)
{
if (seekingTowards_ != movieController_.currentPlaybackTime)
{
seekingRecoverySince_ = movieController_.currentPlaybackTime;
seekRecoveryInProgress_ = YES;
seekInProgress_ = NO;
seekingTowards_ = 0.0;
}
}
else if (seekRecoveryInProgress_)
{
if (seekingRecoverySince_ != movieController_.currentPlaybackTime)
{
seekRecoveryInProgress_ = NO;
seekingRecoverySince_ = 0.0;
}
}
, MPMoviePlayerController "". , . , AVPlayer.