<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPlayerInterstitialEvent/init(primaryItem:identifier:date:templateItems:restrictions:resumptionOffset:playoutLimit:userDefinedAttributes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "s:So25AVPlayerInterstitialEventC12AVFoundationE11primaryItem10identifier4date13templateItems12restrictions16resumptionOffset12playoutLimit21userDefinedAttributesABSo0aF0C_SSSg10Foundation4DateVSayAMGSo0abC12RestrictionsVSo6CMTimeaAVSDySSypGtcfc"
  },
  "title" : "init(primaryItem:identifier:date:templateItems:restrictions:resumptionOffset:playoutLimit:userDefinedAttributes:)"
}
-->

# init(primaryItem:identifier:date:templateItems:restrictions:resumptionOffset:playoutLimit:userDefinedAttributes:)

Creates an interstitial event, with user-defined attributes, for the specified date.

```
convenience init(primaryItem: AVPlayerItem, identifier: String?, date: Date, templateItems: [AVPlayerItem], restrictions: AVPlayerInterstitialEvent.Restrictions = [], resumptionOffset: CMTime = .indefinite, playoutLimit: CMTime = .invalid, userDefinedAttributes: [String : Any] = [:])
```

## Parameters

`primaryItem`

The player item that represents the primary content. The item must contain an [`AVAsset`](/documentation/AVFoundation/AVAsset) that provides intrinsic mappings from its timeline to real-time dates.

`identifier`

An external identifier for the event.

`date`

A date within the date range of the primary item that playback of interstitial content begins.

`templateItems`

An array of player item configurations to use as templates for player items that play interstitial content.

`restrictions`

Restrictions on access to playback controls during the event.

`resumptionOffset`

The time offset for resuming playback of the primary content after interstitial content finishes. You can specify a definite time, or specify <doc://com.apple.documentation/documentation/CoreMedia/CMTime/indefinite> to indicate that the effective resumption time offset needs to align with time elapsed during interstitial playback.

`playoutLimit`

The time offset from the beginning of the interstitial when interstitial playback needs to end, if interstitial assets are longer. Pass a positive numeric value, or <doc://com.apple.documentation/documentation/CoreMedia/CMTime/invalid> to indicate no play out limit.

`userDefinedAttributes`

Custom attributes to add to the event.

---

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)