<!--
{
  "availability" : [
    "macOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaPlayer",
  "identifier" : "/documentation/MediaPlayer/MPMediaItemAnimatedArtwork/init(artworkID:previewImageRequestHandler:videoAssetFileURLRequestHandler:)-7n23z",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Media Player",
      "MediaPlayer"
    ],
    "preciseIdentifier" : "s:So26MPMediaItemAnimatedArtworkC11MediaPlayerE9artworkID26previewImageRequestHandler024videoAssetFileURLRequestL0ABSS_So7NSImageCSgSo6CGSizeVYac10Foundation3URLVSgAKYactcfc"
  },
  "title" : "init(artworkID:previewImageRequestHandler:videoAssetFileURLRequestHandler:)"
}
-->

# init(artworkID:previewImageRequestHandler:videoAssetFileURLRequestHandler:)

Creates an animated artwork.

```
convenience init(artworkID: String, previewImageRequestHandler: @escaping (CGSize) async -> NSImage?, videoAssetFileURLRequestHandler: @escaping (CGSize) async -> URL?)
```

## Parameters

`artworkID`

A unique identifier for this animated artwork. This identifier should
encapsulate the identity of both the preview frame and video asset. If you change either,
you should provide an [`MPMediaItemAnimatedArtwork`](/documentation/MediaPlayer/MPMediaItemAnimatedArtwork) with an updated `artworkID`.

`previewImageRequestHandler`

A handler to return a preview image for this artwork, for
the requested `CGSize` in pixels. You can return `nil` if the preview image cannot be
resolved for any reason. The `NSImage` you return should ideally have a size equal to the
requested `CGSize`, however an image of the same aspect ratio is acceptable. Images that
diverge significantly from the requested aspect ratio may be rejected by the system. Aim
to return preview images quickly and ideally synchronously, and if possible you should
preload these images in order to reduce perceived latency when displaying animated artwork
to the user.

`videoAssetFileURLRequestHandler`

A handler to return a file `URL` for the artwork video
asset for this artwork, for the requested `CGSize` in pixels. You can return `nil` if the
artwork video asset cannot be resolved for any reason. The `URL` you return must reference
a local asset, ideally with a size equal to the requested `CGSize`, however an asset with
the same aspect ratio is acceptable. Assets that diverge significantly from the requested
aspect ratio may be rejected by the system. The video assets you provide should loop
cleanly, and should be available relatively quickly from this handler (particularly when
re-fetched). It’s advised that assets are cached for subsequent fetches.

---

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)