mode property

TextTrackMode get mode

The TextTrack interface's mode property is a string specifying and controlling the text track's mode: disabled, hidden, or showing. You can read this value to determine the current mode, and you can change this value to switch modes.

Safari additionally requires the default boolean attribute to be set to true when implementing your own video player controls in order for the subtitles cues to be shown.

Value

A string which indicates the track's current mode. One of:

  • disabled
    • : The text track is currently disabled. While the track's presence is exposed in the DOM, the user agent is otherwise ignoring it. No cues are active, no events are being fired, and the user agent won't attempt to obtain the track's cues. This is the default value, unless the text track has the default Boolean attribute is specified, in which case the default is showing.
  • hidden
    • : The text track is currently active but the cues aren't being displayed. If the user agent hasn't tried to obtain the track's cues yet, it will do so soon (thereby populating the track's TextTrack.cues property). The user agent is keeping a list of the active cues (in the track's TextTrack.activeCues property) and events are being fired at the corresponding times, even though the text isn't being displayed.
  • showing
    • : The text track is currently enabled and is visible. If the track's cues list hasn't been obtained yet, it will be soon. The TextTrack.activeCues list is being maintained and events are firing at the appropriate times; the track's text is also being drawn appropriately based on the styling and the track's TextTrack.kind. This is the default value if the text track's default Boolean attribute is specified.

Implementation

external TextTrackMode get mode;
set mode (TextTrackMode value)

Implementation

external set mode(TextTrackMode value);