AI-generated Key Takeaways
-
AudioTracksManager manages audio tracks and should be instantiated by calling
cast.framework.PlayerManager#getAudioTracksManager. -
It provides methods to get the active audio track ID, the active audio track, a track by its ID, all audio tracks, and tracks by language.
-
You can set the active audio track by its ID or by its language.
cast.
framework
.
AudioTracksManager
Manages audio tracks.
- Throws
-
non-null Errorif the constructor is used directly. TheAudioTracksManagershould be instantiated by calling cast.framework.PlayerManager#getAudioTracksManager .
Methods
getActiveId
getActiveId() returns number
Gets the active audio track ID.
- Returns
-
nullable number
getActiveTrack
getActiveTrack() returns cast.framework.messages.Track
Gets the active audio track.
- Returns
-
nullable cast.framework.messages.Track
getTrackById
getTrackById(id) returns cast.framework.messages.Track
Gets the audio track that matches id
.
Parameter
id
number
- Throws
-
non-null Errorifidis unavailable or invalid. - Returns
-
nullable cast.framework.messages.Track
getTracks
getTracks() returns Array of non-null cast.framework.messages.Track
Returns all audio 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 all the audio tracks that match language
.
Parameter
language
string
Language tag as per RFC 5646.
- Throws
-
non-null Erroriflanguageis not available. - Returns
-
non-null Array of non-null cast.framework.messages.Track
setActiveById
setActiveById(id)
Sets the audio track that matches id
to the active state.
Parameter
id
number
The track ID
- Throws
-
non-null Errorifidis not an audio track ID.
setActiveByLanguage
setActiveByLanguage(language)
Sets the first audio track that matches language
to the active state.
Parameter
language
string
Language tag as per RFC 5646.
- Throws
-
non-null Erroriflanguageis not available or invalid.

