Last active
August 29, 2015 14:10
-
-
Save NghiaTranUIT/6aaac1fe9fd52600507a to your computer and use it in GitHub Desktop.
Pause video at 15th second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__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