TextTrack
public protocol TextTrack : Track
A TextTrack object is an element that represents a single text track that can be displayed in the player.
-
The text track in-band metadata track dispatch type of the text track that the TextTrack object represents.
Declaration
Swift
var inBandMetadataTrackDispatchType: String { get }
-
The text track mode.
Remark
- For all possibilities, see:
TextTrackMode
.
Declaration
Swift
var mode: TextTrackMode { get set }
- For all possibilities, see:
-
The text track’s list of TextTrackCue objects as a TextTrackCueList. This list includes all of the text track’s known cues.
Declaration
Swift
var cues: [TextTrackCue] { get }
-
The text track’s resource path
Declaration
Swift
var src: String { get }
-
The text track’s list of active TextTrackCue objects as a TextTrackCueList.
Remark
This list dynamically updates as time progresses so that it includes all cues that are currently active. Currently active cues are ones that start before the current playback position and end after it.Declaration
Swift
var activeCues: [TextTrackCue] { get }
-
The content type of the given track.
Remark
webvtt
: The track contains WebVTT (Web Video Text Tracks) content.
Declaration
Swift
var type: String { get }
-
Indicates whether the track contains Forced Narrative cues.
Remark
- The corresponding #EXT-X-MEDIA tag contains the attributes TYPE=SUBTITLES and FORCED=YES in the manifest.
Declaration
Swift
var forced: Bool { get }
-
Adds the given event listener of the given TextTrackEventType.
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
TextTrackEventType 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 TextTrackEventType.
Declaration
Swift
func removeEventListener<E>(type: EventType<E>, listener: EventListener) where E : EventProtocol
Parameters
type
TextTrackEventType of the removed event listener.
listener
EventListener object that has been return on addEventListener.