<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVSampleBufferRenderSynchronizer/addPeriodicTimeObserver(forInterval:queue:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSampleBufferRenderSynchronizer(im)addPeriodicTimeObserverForInterval:queue:usingBlock:"
  },
  "title" : "addPeriodicTimeObserver(forInterval:queue:using:)"
}
-->

# addPeriodicTimeObserver(forInterval:queue:using:)

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

```
func addPeriodicTimeObserver(forInterval interval: CMTime, queue: dispatch_queue_t?, using block: @escaping @Sendable (CMTime) -> Void) -> Any
```

## Parameters

`interval`

The specified time interval requesting block invocation during rendering.

`queue`

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.

`block`

The block to be invoked periodically.

## Return Value

An object that conforms to <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class>. You must retain this value as long as you want the time observer to be invoked by the synchronizer. Pass this object to [`removeTimeObserver(_:)`](/documentation/AVFoundation/AVSampleBufferRenderSynchronizer/removeTimeObserver(_:)) to cancel time observation.

## Discussion

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(_:)`](/documentation/AVFoundation/AVSampleBufferRenderSynchronizer/removeTimeObserver(_:)). Releasing the observer without calling `removeTimeObserver(_:)` results in undefined behavior.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)