TextTrackCue

public protocol TextTrackCue : EventDispatcherProtocol

A TextTrackCue object represents an individual cue and provides methods and properties to access the data and events to act on changes to cue state. Depending on the TextTrack’s type, a cue might have different properties.

  • The cue’s content.

    Remark

    • The type depends of the cue type.

    Declaration

    Swift

    var content: Any? { get }
  • If the cue’s type is WebVtt, the contentString is used. It contains the text track cue text in raw unparsed form.

    Declaration

    Swift

    var contentString: String? { get }
  • If the cue’s type is WebVtt, the contentDictionary is used. It contains the text track cue info in a dictionary.

    Declaration

    Swift

    var contentDictionary: [String : String]? { get }
  • The time in seconds and relative to a THEOplayer instance’s currentTime at which the cue becomes inactive.

    Declaration

    Swift

    @available(*, deprecated, message: "This property will no longer be optional with the next major release.")
    var endTime: Double? { get }
  • id

    The cue’s identifier.

    Declaration

    Swift

    var id: String { get }
  • uid

    The cue’s unique identifier.

    Remark

    This identifier is unique across text track cues of a THEOplayer instance and can be used to distinguish between cues.

    This identifier is a randomly generated number.

    Declaration

    Swift

    @available(*, deprecated, message: "This property type will change from Double to Int with the next major release.")
    var uid: Double { get }
  • The time in seconds and relative to a THEOplayer instance’s currentTime at which the cue becomes active.

    Declaration

    Swift

    @available(*, deprecated, message: "This property will no longer be optional with the next major release.")
    var startTime: Double? { get }
  • The track the given cue belongs to.

    Declaration

    Swift

    var track: TextTrack? { get }
  • Adds the given event listener of the given TextTrackCueEventType.

    Remark

    When attaching a listener on the wrong object the application will crash.

    Declaration

    Swift

    func addEventListener<E>(type: EventType<E>, listener: @escaping (E) -> ()) -> EventListener where E : EventProtocol

    Parameters

    type

    TextTrackCueEventType of the added event listener.

    listener

    Closure called when event is dispatched.

    Return Value

    EventListener that can be removed

  • Removes the given event listener of the given TextTrackCueEventType.

    Declaration

    Swift

    func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol

    Parameters

    type

    TextTrackCueEventType of the removed event listener.

    listener

    EventListener object that has been return on addEventListener.