---
title: "init(id:supportedAspectRatios:preview:video:)"
framework: nowplaying
role: symbol
role_heading: Initializer
path: "nowplaying/animatedartwork/init(id:supportedaspectratios:preview:video:)"
---

# init(id:supportedAspectRatios:preview:video:)

Creates an animated artwork whose preview and video assets load on demand.

## Declaration

```swift
init(id: String, supportedAspectRatios: [AnimatedArtwork.AspectRatio] = [.square], preview previewProvider: @escaping @Sendable (CGSize, AnimatedArtwork.AspectRatio) async throws -> ArtworkRepresentation, video videoProvider: @escaping @Sendable (CGSize, AnimatedArtwork.AspectRatio) async throws -> URL)
```

## Parameters

- `id`: A unique identifier for this artwork.
- `supportedAspectRatios`: The aspect ratios your app supports.
- `previewProvider`: A closure that loads a preview image for the specified size and aspect ratio.
- `videoProvider`: A closure that provides a URL to a video file for the specified size and aspect ratio.
