<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerItemMetadataOutput/setDelegate(_:queue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPlayerItemMetadataOutput(im)setDelegate:queue:"
  },
  "title" : "setDelegate(_:queue:)"
}
-->

# setDelegate(_:queue:)

Sets the delegate and a dispatch queue on which the delegate is called.

```
func setDelegate(_ delegate: (any AVPlayerItemMetadataOutputPushDelegate)?, queue delegateQueue: dispatch_queue_t?)
```

## Parameters

`delegate`

An object conforming to [`AVPlayerItemMetadataOutputPushDelegate`](/documentation/AVFoundation/AVPlayerItemMetadataOutputPushDelegate) protocol.

`delegateQueue`

A dispatch queue on which all delegate methods will be called.

## Discussion

You specify the metadata delegate, and a dispatch queue on which it will be called, to be notified as new metadata is encountered in the source media.

> Important:
> The values set for the `delegate` and `delegateQueue` arguments can be `nil` , but passing `nil` for one requires you to do the same for the other. Passing a `nil` value for only one argument results in an exception being raised at runtime.

---

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)