TextTrack Class

public class TextTrack : Track, Equatable, CustomStringConvertible

Text track metadata (subtitles/captions) and rendering hints.

Lifecycle

  • Creates a text track descriptor.

    Declaration

    Swift

    public init(
        id: String,
        format: TextFormat,
        isPlatformRendered: Bool,
        source: String = "",
        primary: Bool = false,
        roles: Roles = Roles(),
        properties: Properties = Properties(),
        label: String = "",
    
        language: String = "",
        sourceUrl: URL? = nil,
        isForced: Bool = false,
        kind: String = "")

    Parameters

    id

    Stable track identifier.

    format

    Subtitle/text payload format.

    isPlatformRendered

    Whether rendering is delegated to platform player.

    source

    Source/adaptation-set identifier.

    primary

    Whether this track is marked primary.

    roles

    Role metadata map.

    properties

    Extra property metadata map.

    label

    User-visible track label.

    language

    Language code.

    sourceUrl

    Optional URL to sideloaded/remote track source.

    isForced

    Whether this is a forced subtitle track.

    kind

    Provider-defined text-track kind.

Public

  • Track type discriminator.

    Declaration

    Swift

    public let trackType: TrackType
  • id

    Track identifier.

    Declaration

    Swift

    public let id: String
  • Source group identifier (provider-defined).

    Declaration

    Swift

    public let source: String
  • Whether this is marked as primary track.

    Declaration

    Swift

    public let primary: Bool
  • Role metadata.

    Declaration

    Swift

    public let roles: Roles
  • Extra property metadata.

    Declaration

    Swift

    public let properties: Properties
  • User-visible label.

    Declaration

    Swift

    public let label: String
  • Text format type.

    Declaration

    Swift

    public let format: TextFormat
  • Language code for this text track.

    Declaration

    Swift

    public let language: String
  • Optional remote/local source URL.

    Declaration

    Swift

    public let sourceUrl: URL?
  • Indicates forced-subtitle semantics.

    Declaration

    Swift

    public let isForced: Bool
  • Provider-defined text-track kind.

    Declaration

    Swift

    public let kind: String
  • Indicates whether platform renderer (e.g. AVPlayer) displays this track.

    Declaration

    Swift

    public let isPlatformRendered: Bool
  • Compares two text tracks field-by-field.

    Declaration

    Swift

    public static func == (lhs: TextTrack, rhs: TextTrack) -> Bool
  • Human-readable diagnostic representation.

    Declaration

    Swift

    public var description: String { get }