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

# addBoundaryTimeObserver(forTimes:queue:using:)

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

```
func addBoundaryTimeObserver(forTimes times: [NSValue], queue: dispatch_queue_t?, using block: @escaping @Sendable () -> Void) -> Any
```

## Parameters

`times`

An array containing the times for which the observer requests notification.

`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 when any of the specified times is crossed during normal rendering.

## 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

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)