I'm writing an app for iOS 4.3 and above and using automatic reference counting
. I have a video which is played using an AVPlayer
and would like to be able to pause this video when a given CMTime
is reached. I am currently using addBoundaryTimeObserverForTimes
and pausing the AVPlayer
inside the block
which is called. It works but I receive the error:
Capturing 'self' strongly in this block is likely to lead to a retain cycle
My code:
timeObserver = [player addBoundaryTimeObserverForTimes:endTime //An array of one NSValue representing a CMTime
queue:NULL
usingBlock:^{
[player pause];
}];
I can't work out the correct way of doing this and would be very grateful for any help.
Thank you!