Skip to content

Instantly share code, notes, and snippets.

@NghiaTranUIT
Last active August 29, 2015 14:10
Show Gist options
  • Save NghiaTranUIT/6aaac1fe9fd52600507a to your computer and use it in GitHub Desktop.
Save NghiaTranUIT/6aaac1fe9fd52600507a to your computer and use it in GitHub Desktop.
Pause video at 15th second
__weak FePreviewVideoViewController *weakSelf = self;
timeObserver = [_player addPeriodicTimeObserverForInterval:CMTimeMake(15, 1) queue:dispatch_get_main_queue() usingBlock:^(CMTime time)
{
typeof(self) strongSelf = weakSelf;
CGFloat currentTime = CMTimeGetSeconds(time);
if (currentTime >= 15)
{
[strongSelf.player pause];
// Remove O
[strongSelf.player removeTimeObserver:timeObserver];
timeObserver = nil;
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment