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. 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
var endTime: Double? { get }
-
The cue’s unique ID.
Declaration
Swift
var id: String { get }
-
The time in seconds and relative to a THEOplayer instance’s currentTime at which the cue becomes active.
Declaration
Swift
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