TracksManager
public class TracksManager
The TracksManager class is responsible for managing and selecting media tracks during playback, such as audio and subtitle tracks.
It provides methods to get the available tracks, retrieve the currently selected audio and subtitle tracks, and select a specific track based on type and identifier.
-
Retrieves all available media tracks for the current content.
This method returns an array of
MediaTrackobjects representing the different tracks (audio, subtitles.) that are available for the current media content. If no tracks are available, it returnsnil.Declaration
Swift
public func getTracks() -> [MediaTrack]?Return Value
An array of
MediaTrackobjects representing the available media tracks, ornilif no tracks are available. -
Retrieves the currently selected audio track.
This method returns the
MediaTrackobject that represents the audio track currently selected for playback. If no audio track is selected, it returnsnil.Declaration
Swift
public func getSelectedAudioTrack() -> MediaTrack?Return Value
The
MediaTrackobject representing the selected audio track, ornilif no audio track is selected. -
Retrieves the currently selected subtitle track.
This method returns the
MediaTrackobject that represents the subtitle track currently selected for display. If no subtitle track is selected, it returnsnil.Declaration
Swift
public func getSelectedSubtitleTrack() -> MediaTrack?Return Value
The
MediaTrackobject representing the selected subtitle track, ornilif no subtitle track is selected. -
Selects a specific media track based on the provided type and identifier.
This method allows you to select a particular track, such as an audio or subtitle track, based on its type and identifier. The method returns a boolean value indicating whether the selection was successful.
Declaration
Swift
@discardableResult public func selectTrack(type: MediaTrackType, identifier: MediaTrackIdentifier) -> BoolParameters
typeA
MediaTrackTypevalue that specifies the type of track to select (e.g., audio, subtitle).identifierA
MediaTrackIdentifierthat uniquely identifies the track to be selected.Return Value
A boolean value indicating whether the track was successfully selected.