# Download Class

    open class Download : Codable

Download

### Public

- `uuid`

  Download identifier.

  #### Declaration

  Swift

      public let uuid: String

- `playerConfiguration`

  Source playback configuration used to create this download.

  #### Declaration

  Swift

      public let playerConfiguration: PlayerConfiguration

- `startDate`

  Creation timestamp.

  #### Declaration

  Swift

      public let startDate: TimeInterval

- `title`

  User-visible title associated with this download.

  #### Declaration

  Swift

      public var title: String

- `localRelativePath`

  Relative local storage path.

  #### Declaration

  Swift

      public var localRelativePath: String?

- `userMeta`

  User metadata attached to this download.

  #### Declaration

  Swift

      public var userMeta: [String : String]?

- `resumeData`

  Resume data blob used to continue interrupted transfers.

  #### Declaration

  Swift

      public var resumeData: Data?

- `redirectedUrl`

  Redirect-resolved remote URL, when applicable.

  #### Declaration

  Swift

      public var redirectedUrl: URL?

- `headers`

  Additional request headers used by download operations.

  #### Declaration

  Swift

      public var headers: [String : String]?

- `allowCellularAccess`

  Whether download requests may use cellular transport.

  #### Declaration

  Swift

      public var allowCellularAccess: Bool

- `filterIFrameTracks`

  Whether I-frame/trickplay tracks should be excluded.

  #### Declaration

  Swift

      public var filterIFrameTracks: Bool

- `tracks`

  Track model associated with this download.

  #### Declaration

  Swift

      public var tracks: [Track]?

- `localSideloadedTracks`

  Side-loaded tracks (subtitles/thumbnails) that have been downloaded for offline playback.

  Each entry mirrors the matching `PlayerConfiguration.sideloadedTracks` descriptor, but its `url` is a path relative to `NSHomeDirectory()` (same convention as `localRelativePath`). Use `resolvedLocalSideloadedTracks` to obtain absolute file URLs.

  #### Declaration

  Swift

      public var localSideloadedTracks: [SideloadedTrack]?

### only for DASH streams

- `selectedVideoRenditions`

  Selected video renditions for download.

  #### Declaration

  Swift

      public private(set) var selectedVideoRenditions: [VideoRendition] { get }

- `selectedAudioRenditions`

  Selected audio renditions for download.

  #### Declaration

  Swift

      public private(set) var selectedAudioRenditions: [Rendition] { get }

- `selectedTextTracks`

  Selected text tracks for download.

  #### Declaration

  Swift

      public private(set) var selectedTextTracks: [TextTrack] { get }

- `selectedSideloadedTracks`

  Selected side-loaded tracks (subtitles/thumbnails) for download.

  Defaults to all side-loaded tracks declared on the `PlayerConfiguration`, so that callers that do not present a selection UI keep downloading every side-loaded track.

  #### Declaration

  Swift

      public private(set) var selectedSideloadedTracks: [SideloadedTrack] { get }

- `fairplayKeyURIs`

  TODO: Merge this in drm config above? we collect here all the key URIs found in the attribute URI of EXT-X-KEY and EXT-X-SESSION-KEY

  #### Declaration

  Swift

      public var fairplayKeyURIs: [String]

- `preferredBitrate`

  Set your preferred video bitrate to be downloaded.

  The lowest media bitrate greater than or equal to this value will be selected for download. If no suitable media bitrate is found, the highest media bitrate will be selected.

  Remark

  Value is expressed in bps.

  Remark

  Only for HLS streams.

  #### Declaration

  Swift

      public var preferredBitrate: Int?

- `averageBitrate`

  Download average bitrate read from main playlist If present in the playlist, will be used for download size estimation in bytes. Otherwise the peak bitrate will be used for calculations.

  Remark

  Value is expressed in bps.

  Remark

  Only for HLS streams.

  #### Declaration

  Swift

      public var averageBitrate: Int?

- `localUrl`

  Local download URL.

  #### Declaration

  Swift

      public var localUrl: URL? { get }

- `resolvedLocalSideloadedTracks`

  Side-loaded tracks resolved to absolute local file URLs, suitable for offline playback.

  The persisted `localSideloadedTracks` store home-relative paths; this maps each one to an absolute `file://` URL via `NSHomeDirectory()`, mirroring `localUrl`.

  #### Declaration

  Swift

      public var resolvedLocalSideloadedTracks: [SideloadedTrack]? { get }

- `state`

  Current download lifecycle state.

  #### Declaration

  Swift

      public var state: DownloadState { get set }

- `progress`

  Current immutable progress snapshot.

  #### Declaration

  Swift

      public var progress: DownloadProgress { get set }

- `delegate`

  Delegate receiving state/progress callbacks.

  #### Declaration

  Swift

      public var delegate: DownloadDelegate? { get set }

- `isCompleted`

  Returns `true` when download is completed.

  #### Declaration

  Swift

      public var isCompleted: Bool { get }

- `videoTracks`

  Convenience view of video tracks.

  #### Declaration

  Swift

      public var videoTracks: [VideoTrack] { get }

- `audioTracks`

  Convenience view of audio tracks.

  #### Declaration

  Swift

      public var audioTracks: [AudioTrack] { get }

- `textTracks`

  Convenience view of text tracks.

  #### Declaration

  Swift

      public var textTracks: [TextTrack] { get }

- `sideloadedTracks`

  Side-loaded tracks (subtitles/thumbnails) declared on the source configuration.

  #### Declaration

  Swift

      public var sideloadedTracks: [SideloadedTrack] { get }

- `sideloadedTextTracks`

  Convenience view of side-loaded subtitle tracks.

  #### Declaration

  Swift

      public var sideloadedTextTracks: [SideloadedTrack] { get }

- `sideloadedThumbnailTracks`

  Convenience view of side-loaded thumbnail tracks.

  #### Declaration

  Swift

      public var sideloadedThumbnailTracks: [SideloadedTrack] { get }

- `selectVideoRendition(_:)`

  Selects a video rendition for download.

  #### Declaration

  Swift

      public func selectVideoRendition(_ rendition: VideoRendition) -> Bool

  #### Return Value

  `true` when rendition belongs to a known video track.

- `unselectVideoRendition(_:)`

  Unselects a video rendition for download.

  #### Declaration

  Swift

      public func unselectVideoRendition(_ rendition: VideoRendition) -> Bool

  #### Return Value

  `true` when rendition belongs to a known video track.

- `selectAudioRendition(_:)`

  Selects an audio rendition for download.

  #### Declaration

  Swift

      public func selectAudioRendition(_ rendition: AudioRendition) -> Bool

  #### Return Value

  `true` when rendition belongs to a known audio track.

- `unselectAudioRendition(_:)`

  Unselects an audio rendition for download.

  #### Declaration

  Swift

      public func unselectAudioRendition(_ rendition: AudioRendition) -> Bool

  #### Return Value

  `true` when rendition belongs to a known audio track.

- `selectTextTrack(_:)`

  Selects a text track for download.

  #### Declaration

  Swift

      public func selectTextTrack(_ track: TextTrack) -> Bool

  #### Return Value

  `true` when track belongs to the known text-track set.

- `unselectTextTrack(_:)`

  Unselects a text track for download.

  #### Declaration

  Swift

      public func unselectTextTrack(_ track: TextTrack) -> Bool

  #### Return Value

  `true` when track belongs to the known text-track set.

- `selectSideloadedTrack(_:)`

  Selects a side-loaded track (subtitle/thumbnail) for download.

  #### Declaration

  Swift

      @discardableResult
      public func selectSideloadedTrack(_ track: SideloadedTrack) -> Bool

  #### Return Value

  `true` when the track belongs to the configuration’s side-loaded set.

- `unselectSideloadedTrack(_:)`

  Unselects a side-loaded track (subtitle/thumbnail) for download.

  #### Declaration

  Swift

      @discardableResult
      public func unselectSideloadedTrack(_ track: SideloadedTrack) -> Bool

  #### Return Value

  `true` when the track belongs to the configuration’s side-loaded set.

### Private

- `init(from:)`

  #### Declaration

  Swift

      public required init(from decoder: Decoder) throws

- `encode(to:)`

  #### Declaration

  Swift

      public func encode(to encoder: Encoder) throws