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 MediaTrack objects representing the different tracks (audio, subtitles.) that are available for the current media content. If no tracks are available, it returns nil.

    Declaration

    Swift

    public func getTracks() -> [MediaTrack]?

    Return Value

    An array of MediaTrack objects representing the available media tracks, or nil if no tracks are available.

  • Retrieves the currently selected audio track.

    This method returns the MediaTrack object that represents the audio track currently selected for playback. If no audio track is selected, it returns nil.

    Declaration

    Swift

    public func getSelectedAudioTrack() -> MediaTrack?

    Return Value

    The MediaTrack object representing the selected audio track, or nil if no audio track is selected.

  • Retrieves the currently selected subtitle track.

    This method returns the MediaTrack object that represents the subtitle track currently selected for display. If no subtitle track is selected, it returns nil.

    Declaration

    Swift

    public func getSelectedSubtitleTrack() -> MediaTrack?

    Return Value

    The MediaTrack object representing the selected subtitle track, or nil if 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) -> Bool

    Parameters

    type

    A MediaTrackType value that specifies the type of track to select (e.g., audio, subtitle).

    identifier

    A MediaTrackIdentifier that uniquely identifies the track to be selected.

    Return Value

    A boolean value indicating whether the track was successfully selected.