Download Class

open class Download : Codable

Download

Public

  • Download identifier.

    Declaration

    Swift

    public let uuid: String
  • Source playback configuration used to create this download.

    Declaration

    Swift

    public let playerConfiguration: PlayerConfiguration
  • Creation timestamp.

    Declaration

    Swift

    public let startDate: TimeInterval
  • User-visible title associated with this download.

    Declaration

    Swift

    public var title: String
  • Relative local storage path.

    Declaration

    Swift

    public var localRelativePath: String?
  • User metadata attached to this download.

    Declaration

    Swift

    public var userMeta: [String : String]?
  • Resume data blob used to continue interrupted transfers.

    Declaration

    Swift

    public var resumeData: Data?
  • Redirect-resolved remote URL, when applicable.

    Declaration

    Swift

    public var redirectedUrl: URL?
  • Additional request headers used by download operations.

    Declaration

    Swift

    public var headers: [String : String]?
  • Whether download requests may use cellular transport.

    Declaration

    Swift

    public var allowCellularAccess: Bool
  • Whether I-frame/trickplay tracks should be excluded.

    Declaration

    Swift

    public var filterIFrameTracks: Bool
  • Track model associated with this download.

    Declaration

    Swift

    public var tracks: [Track]?
  • 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

  • Selected video renditions for download.

    Declaration

    Swift

    public private(set) var selectedVideoRenditions: [VideoRendition] { get }
  • Selected audio renditions for download.

    Declaration

    Swift

    public private(set) var selectedAudioRenditions: [Rendition] { get }
  • Selected text tracks for download.

    Declaration

    Swift

    public private(set) var selectedTextTracks: [TextTrack] { get }
  • 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 }
  • 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]
  • 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?
  • 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?
  • Local download URL.

    Declaration

    Swift

    public var localUrl: URL? { get }
  • 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 }
  • Current download lifecycle state.

    Declaration

    Swift

    public var state: DownloadState { get set }
  • Current immutable progress snapshot.

    Declaration

    Swift

    public var progress: DownloadProgress { get set }
  • Delegate receiving state/progress callbacks.

    Declaration

    Swift

    public var delegate: DownloadDelegate? { get set }
  • Returns true when download is completed.

    Declaration

    Swift

    public var isCompleted: Bool { get }
  • Convenience view of video tracks.

    Declaration

    Swift

    public var videoTracks: [VideoTrack] { get }
  • Convenience view of audio tracks.

    Declaration

    Swift

    public var audioTracks: [AudioTrack] { get }
  • Convenience view of text tracks.

    Declaration

    Swift

    public var textTracks: [TextTrack] { get }
  • Side-loaded tracks (subtitles/thumbnails) declared on the source configuration.

    Declaration

    Swift

    public var sideloadedTracks: [SideloadedTrack] { get }
  • Convenience view of side-loaded subtitle tracks.

    Declaration

    Swift

    public var sideloadedTextTracks: [SideloadedTrack] { get }
  • Convenience view of side-loaded thumbnail tracks.

    Declaration

    Swift

    public var sideloadedThumbnailTracks: [SideloadedTrack] { get }
  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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

  • Declaration

    Swift

    public required init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws