AI-generated Key Takeaways
-
The cast.framework.TextTracksManager manages text tracks and should only be accessed via cast.framework.PlayerManager#getTextTracksManager.
-
It provides methods to add, create, get, set active status, and retrieve information about text tracks based on ID or language.
-
The manager also allows retrieving and setting the style of the text tracks.
cast.
framework
.
TextTracksManager
Manages text tracks.
- Throws
-
non-null ErrorIf constructor is used directly. The TextTracksManager should only be accessed by calling cast.framework.PlayerManager#getTextTracksManager .
Methods
addTracks
addTracks(tracks)
Adds text tracks to the list.
Parameter
tracks
Array of non-null cast.framework.messages.Track
Value must not be null.
- Throws
-
non-null ErrorIf tracks are not available, or trackId is not unique, or add non-text tracks.
createTrack
createTrack() returns cast.framework.messages.Track
Creates a text track.
- Returns
-
non-null cast.framework.messages.Track
getActiveIds
getActiveIds() returns Array of number
Gets all active text ids.
- Throws
-
non-null ErrorIf tracksManager is not available. - Returns
-
non-null Array of number
getActiveTracks
getActiveTracks() returns Array of non-null cast.framework.messages.Track
Gets all active text tracks.
- Throws
-
non-null ErrorIf tracksManager is not available. - Returns
-
non-null Array of non-null cast.framework.messages.Track
getTextTracksStyle
getTextTracksStyle() returns ( cast.framework.messages.TextTrackStyle or undefined)
Returns the current text track style.
- Returns
-
(non-null cast.framework.messages.TextTrackStyle or undefined)
getTrackById
getTrackById(id) returns cast.framework.messages.Track
Gets text track by id.
Parameter
id
number
- Throws
-
non-null ErrorIf id is not available or invalid. - Returns
-
nullable cast.framework.messages.Track
getTracks
getTracks() returns Array of non-null cast.framework.messages.Track
Returns all (non-forced) text tracks.
- Returns
-
non-null Array of non-null cast.framework.messages.Track
getTracksByLanguage
getTracksByLanguage(language) returns Array of non-null cast.framework.messages.Track
Gets text tracks by language.
Parameter
language
string
Language tag as per RFC 5646.
- Throws
-
non-null ErrorIf language is not available. - Returns
-
non-null Array of non-null cast.framework.messages.Track
setActiveByIds
setActiveByIds(newIds)
Sets text tracks to be active by id.
Parameter
newIds
Array of number
The text track ids to be enabled. To clear
text tracks set the value to an empty array or null
.
Value may be null.
- Throws
-
non-null ErrorIf id is invalid.
setActiveByLanguage
setActiveByLanguage(language)
Sets text tracks to be active by language. Only the first matching language track will be enabled.
Parameter
language
string
Language tag as per RFC 5646.
- Throws
-
non-null ErrorIf language is not available or invalid.
setTextTrackStyle
setTextTrackStyle(style)
Sets text track style.
Parameter
style
cast.framework.messages.TextTrackStyle
Value must not be null.

