Instance Method


Requests invocation of a block during rendering at specified time intervals.


- (id)addPeriodicTimeObserverForInterval:(CMTime)interval queue:(dispatch_queue_t)queue usingBlock:(void (^)(CMTime time))block;



The specified time interval requesting block invocation during rendering.


The serial queue the block should be unqueued on. If you pass NULL, the main queue is used. Passing a concurrent queue results in undefined behavior.


The block to be invoked periodically.

Return Value

An object that conforms to NSObject. You must retain this value as long as you want the time observer to be invoked by the synchronizer. Pass this object to removeTimeObserver: to cancel time observation.


The block associated with this method is invoked at the specified time intervals, interpreted according to the timeline of the timebase. The block is also invoked whenever there is a time jump or rendering starts or stops.

If a very short time interval is used, the synchronizer may invoke the block less frequently than requested. However, the synchronizer will invoke the block often enough for the client to update indications of the current time appropriately in its end-user interface.

Always pair a call to this method with a call to removeTimeObserver:. Releasing the observer without calling removeTimeObserver(_:) results in undefined behavior.

See Also

Working with Time Observers

- addBoundaryTimeObserverForTimes:queue:usingBlock:

Requests invocation of a block when specified times are traversed during normal rendering.

- removeTimeObserver:

Cancels the specified time observer.